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

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


flimbo123







Wiek: 33
Na forum: 5917 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

Witam, pr?buj? ukmini? co? z w?asnymi zegarami w poje?dzie. Wyrzuca mi takie b??dy:

Kod zegar?w:
local screenW, screenH = guiGetScreenSize() 
function speed ( )
    addEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler ("onClientVehicleEnter", root, speed)

function hideSpeed ( )
    removeEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler("onClientVehicleExit", root, hideSpeed)
local v = getPedOccupiedVehicle, ( root )
local przebieg = getElementData (v,("przeb"))
local location = getZoneName ( x, y, z, true )

function hud ( )
        if isPedInVehicle (localPlayer) == false then return end
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer))
        kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) --obliczamy pr?dko?? (m/s * 180 = 1 km/h)
        dxDrawText(""..tostring(kmhs).."", screenW * 0.4427, screenH * 0.7278, screenW * 0.5219, screenH * 0.7880, tocolor(255, 255, 255, 255), 3.00, "bankgothic", "center", "center", false, false, false, false, false)
        dxDrawText("km/h", screenW * 0.5297, screenH * 0.7620, screenW * 0.5604, screenH * 0.7880, tocolor(255, 255, 255, 255), 1.00, "default", "center", "bottom", false, false, false, false, false)
        dxDrawText(""..tostring(location).."", screenW * 0.3896, screenH * 0.7824, screenW * 0.4859, screenH * 0.8204, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "center", false, false, false, false, false)
        dxDrawText(""..tostring(przebieg).."", screenW * 0.4453, screenH * 0.8694, screenW * 0.5198, screenH * 0.9056, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
    end
addEventHandler("onClientRender",getRootElement(),hud)




Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-07, 12:01


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

W getPedOccupiedVehicle daj zamiast root getLocalPlayer() A z getZoneName podajesz nie zdefiniowane zmienne pozycje pobierasz za pomoc? getElementPostion. I daj wszystko w funkcj? hud()

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-07, 14:44


flimbo123







Wiek: 33
Na forum: 5917 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

 local screenW, screenH = guiGetScreenSize() 
function speed ( )
    addEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler ("onClientVehicleEnter", root, speed)

function hideSpeed ( )
    removeEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler("onClientVehicleExit", root, hideSpeed)

function hud ( )
    local v = getPedOccupiedVehicle, ( getLocalPlayer() )
    local przebieg = getElementData ( v,("przeb"))
    local x,y,z = getElementPosition( getLocalPlayer() )
    local location = getZoneName ( x, y, z, true )
        if isPedInVehicle (localPlayer) == false then return end
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer))
        kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) --obliczamy pr?dko?? (m/s * 180 = 1 km/h)
        dxDrawText(""..tostring(kmhs).."", screenW * 0.4427, screenH * 0.7278, screenW * 0.5219, screenH * 0.7880, tocolor(255, 255, 255, 255), 3.00, "bankgothic", "center", "center", false, false, false, false, false)
        dxDrawText("km/h", screenW * 0.5297, screenH * 0.7620, screenW * 0.5604, screenH * 0.7880, tocolor(255, 255, 255, 255), 1.00, "default", "center", "bottom", false, false, false, false, false)
        dxDrawText(""..tostring(location).."", screenW * 0.3896, screenH * 0.7824, screenW * 0.4859, screenH * 0.8204, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "center", false, false, false, false, false)
        dxDrawText(""..tostring(przebieg).."", screenW * 0.4453, screenH * 0.8694, screenW * 0.5198, screenH * 0.9056, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
    end
addEventHandler("onClientRender",getRootElement(),hud)







Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-07, 14:46


AteX







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

Piwa: 8366

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

Usu? nawiasy przy "przeb" i przecinek po getPedOccupiedVehicle.

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

 
Wysłany: 2016-06-08, 15:13


flimbo123







Wiek: 33
Na forum: 5917 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

Dzi?ki, zadzia?a?o. Mo?e mi kto? jeszcze co? poradzi? na zaokr?glanie do jednej cyfry po przecinku gdy? przebieg pokazuje mi duuuu?y ci?g cyfr ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-08, 15:20


AteX







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

Piwa: 8366

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

string.format("%.1f", cyfra)


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

 
Wysłany: 2016-06-08, 16:06


_Haze

Peace Yo!






Wiek: 25
Na forum: 4325 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

math.floor math.ceil

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-08, 16:23


AteX







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

Piwa: 8366

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

"Hazmudex" napisał/a:

math.floor math.ceil


To mu zaokr?gli liczb? do ca?kowitej w d?? lub w g?r?, a on chce 1 miejsce po przecinku...

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

 
Wysłany: 2016-06-08, 22:25


flimbo123







Wiek: 33
Na forum: 5917 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

A poinstruuje kto? jak zastosowa? to w kodzie?



local screenW, screenH = guiGetScreenSize() 
function speed ( )
    addEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler ("onClientVehicleEnter", root, speed)

function hideSpeed ( )
    removeEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler("onClientVehicleExit", root, hideSpeed)

function hud ( )
    local v = getPedOccupiedVehicle ( getLocalPlayer() )
    local przebieg = getElementData ( v,"przeb")
    local x,y,z = getElementPosition( getLocalPlayer() )
    local location = getZoneName ( x, y, z, true )
        if isPedInVehicle (localPlayer) == false then return end
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer))
        kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) --obliczamy pr?dko?? (m/s * 180 = 1 km/h)
        dxDrawText(""..tostring(kmhs).."", screenW * 0.4427, screenH * 0.7278, screenW * 0.5219, screenH * 0.7880, tocolor(255, 255, 255, 255), 3.00, "bankgothic", "center", "center", false, false, false, false, false)
        dxDrawText("km/h", screenW * 0.5297, screenH * 0.7620, screenW * 0.5604, screenH * 0.7880, tocolor(255, 255, 255, 255), 1.00, "default", "center", "bottom", false, false, false, false, false)
        dxDrawText(""..tostring(location).."", screenW * 0.3896, screenH * 0.7824, screenW * 0.4859, screenH * 0.8204, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "center", false, false, false, false, false)
        dxDrawText(""..tostring(przebieg).."", screenW * 0.4453, screenH * 0.8694, screenW * 0.5198, screenH * 0.9056, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
    end
addEventHandler("onClientRender",getRootElement(),hud)






Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-09, 14:04


AteX







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

Piwa: 8366

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

 local przebieg = string.format("%.1f",getElementData ( v,"przeb"))


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

 
Wysłany: 2016-06-09, 14:30


flimbo123







Wiek: 33
Na forum: 5917 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

?liczne dzi?ki, temat do zamkni?cia. Genialna i profesjonalna pomoc :piwo:

Postaw piwo autorowi tego posta
 

 
Tagi: zegary :: pojeździe :: bad :: argument
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zegary w pojeździe - bad argument 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