Wysłany: 2014-07-08, 13:37
zabijaka2000
Wiek: 26 Na forum: 4983 dni Posty: 147
Nick w MP: aleks556
Piwa : 13
Witajcie,
chcia?em zrobi? licznik auta, ale zamiast np. 120 km/h wy?wietla 120.4595495.
Jak to naprawi??
function velocity_render ()
local sWidth , sHeight = guiGetScreenSize ()
local auto = getPedOccupiedVehicle ( localPlayer )
if auto then
local speedx , speedy , speedz = getElementVelocity ( auto )
actualspeed = ( speedx ^ 2 + speedy ^ 2 + speedz ^ 2 )^( 0.5 )
kmh = actualspeed * 180
dxDrawText ( kmh .. " km/h" , sWidth * 0.797 , sHeight * 0.859 , sWidth * 0.993 , sHeight * 0.917 , tocolor ( 0 , 0 , 0 , 255 ), 3.00 , "default-bold" , "left" , "top" , false , false , true , false , false )
dxDrawText ( kmh .. " km/h" , sWidth * 0.796 , sHeight * 0.858 , sWidth * 0.992 , sHeight * 0.916 , tocolor ( 136 , 125 , 117 , 255 ), 3.00 , "default-bold" , "left" , "top" , false , false , true , false , false )
end
end
addEventHandler ( "onClientRender" , root , velocity_render )
Wygl?da to tak:
Wysłany: 2014-07-08, 14:08
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
U?yj math.floor lub math.ceil w zale?no?ci jaki efekt chcesz osi?gn?? - math.floor jak sama nazwa wskazuje zaokr?gla w d?? (np. z 1.415 do 1) a math.ceil w g?r? (np. z 1.415 do 2)
function velocity_render ()
local sWidth , sHeight = guiGetScreenSize ()
local auto = getPedOccupiedVehicle ( localPlayer )
if auto then
local speedx , speedy , speedz = getElementVelocity ( auto )
actualspeed = ( speedx ^ 2 + speedy ^ 2 + speedz ^ 2 )^( 0.5 )
kmh = math . floor ( actualspeed * 180 )
dxDrawText ( kmh .. " km/h" , sWidth * 0.797 , sHeight * 0.859 , sWidth * 0.993 , sHeight * 0.917 , tocolor ( 0 , 0 , 0 , 255 ), 3.00 , "default-bold" , "left" , "top" , false , false , true , false , false )
dxDrawText ( kmh .. " km/h" , sWidth * 0.796 , sHeight * 0.858 , sWidth * 0.992 , sHeight * 0.916 , tocolor ( 136 , 125 , 117 , 255 ), 3.00 , "default-bold" , "left" , "top" , false , false , true , false , false )
end
end
addEventHandler ( "onClientRender" , root , velocity_render )
Tagi: predkosc
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: