Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-07-30, 09:33


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Witam. Chc? zrobi? prosty na ?wiecie licznik za pomoc? dxdrawtext. Podacie mi funkcje? :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 09:42


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3


Więcej informacji znajdziesz w Wikipedii MTA:

dxDrawText


Więcej informacji znajdziesz w Wikipedii MTA:

getElementVelocity


Więcej informacji znajdziesz w Wikipedii MTA:

getPedOccupiedVehicle


Więcej informacji znajdziesz w Wikipedii MTA:

onClientRender


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:12


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

1. Brak DB3.
2. Co? zepsu?em.
3. Jak gracz jest w poje?dzie nie wy?wietla mu si? dx.
4. ?? ?


function dxy2()
    dxDrawText("Pr?dko??:", 1654, 967, 1888, 1001, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false)
        dxDrawText(getElementVelocity(vehicle).."km/h", 1747, 968, 1865, 991, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false)
end

function pojazd4(vehicle)
    if isPedInVehicle then
        addEventHandler("onClientRender", getRootElement(), dxy2)
end
end

function pojazd3(vehicle)
if not isPedInVehicle then
removeEventHandler("onClientRender", getRootElement(), pojazd3)
end
end


Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:16


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Funkcja isPedInVehicle, chyba potrzebuje argumentu gracza, chocia? i tak ta funkcja jest niepotrzebna. Po drugie czym ty wywo?ujesz te funkcje pojazd4 i pojazd3? Po trzecie getElementVelocity nie masz wyliczone na kilometry. Zobacz przyk?ad na wiki, zamiast bezsensownie kopiowa? wzory.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:34


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

1. Zrobi?em od nowa.

2. Skoro m?wisz, ?e isPedInVehicle jest nie potrzeba usuwam j?.

3. B??d w tym kodzie:



addEventHandler("onClientRender", getRootElement(),
function()
    speedx, speedy, speedz = getElementVelocity(getPedOccupiedVehicle(vehicle)
        kmh = predkosc * 180
            dxDrawText("kmh", 1793, 997, 1971, 1033, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false)
end
end
end)


Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:37


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3


local sx, sy = guiGetScreenSize()
addEventHandler("onClientRender", root, function()
if not isPedInVehicle(localPlayer) then return end
local veh = getPedOccupiedVehicle(localPlayer)
local speedx, speedy, speedz = getElementVelocity(getPedOccupiedVehicle(vehicle)
local kmh = predkosc * 180
dxDrawText(tostring(kmh), sx/2-dxGetTextWidth(tostring(kmh), 2, "default")/2, sy/2, 0, 0, tocolor(255,255,255,255), 2, "default")
end)


Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:40


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

1. Pogubi?e? endy (staram si? poprawi? te endy, ale ca?y czas ten sam b??d wyskakuje).

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:43


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

gdzie endy k**** pogubilem zamykam funkcj?, jeden end tylko trzeba by?o da?... ten if na g?rze ma sw?j end w tej samej linijce

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:45


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Zastanawiaj?ce nieprawda? :)

http://imgur.com/a/0RhuU

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:48


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

ty baranie, nawiasu brakuje a nie end

local sx, sy = guiGetScreenSize()
addEventHandler("onClientRender", root, function()
if not isPedInVehicle(localPlayer) then return end
local veh = getPedOccupiedVehicle(localPlayer)
local speedx, speedy, speedz = getElementVelocity(getPedOccupiedVehicle(vehicle))
local kmh = predkosc * 180
dxDrawText(tostring(kmh), sx/2-dxGetTextWidth(tostring(kmh), 2, "default")/2, sy/2, 0, 0, tocolor(255,255,255,255), 2, "default")
end)


Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:50


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

I to tak leci.



:ph34r::ph34r::ph34r:

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:53


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Jurandovsky sam widz? nie lepszy jeste? w Lua.
local sx, sy = guiGetScreenSize()
addEventHandler("onClientRender", root, function()
if not isPedInVehicle(localPlayer) then return end
local veh = getPedOccupiedVehicle(localPlayer)
local speedx, speedy, speedz = getElementVelocity(getPedOccupiedVehicle(vehicle))
local predkosc = (speedx^2 + speedy^2 + speedz^2)^(0.5)
local kmh = predkosc * 180
dxDrawText(tostring(kmh), sx/2-dxGetTextWidth(tostring(kmh), 2, "default")/2, sy/2, 0, 0, tocolor(255,255,255,255), 2, "default")
end)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 10:55


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

AteX, I tak sobie znowu to leci :)

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 11:01


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Ca?y ten kod by? zepsuty "skrypterzy". Ten b?dzie dzia?a?.
local sx, sy = guiGetScreenSize()
addEventHandler("onClientRender", root, function()
    local veh = getPedOccupiedVehicle(localPlayer)
    if veh then
        local speedx, speedy, speedz = getElementVelocity(veh)
        local predkosc = (speedx^2 + speedy^2 + speedz^2)^(0.5)
        local kmh = predkosc * 180
        dxDrawText(math.floor(kmh), sx/2, sy/2, 0, 0, tocolor(255,255,255,255), 2, "default")
    end
end)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 11:06


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540



Zrestartowa?em serwery, wy??czy?em skrypt - pr?bowa?em na wszystkie sposoby.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Tagi: prosty :: świecie :: licznik
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku