Wysłany: 2016-07-14, 15:04
flimbo123
Wiek: 33 Na forum: 5776 dni Posty: 93
Nick w MP: Flimbo
Piwa : 190
local dxfont0_LCD - L = dxCreateFont ( ":zegary/LCD-L.ttf" , 61 )
local dxfont1_LCD - L = dxCreateFont ( ":zegary/LCD-L.ttf" , 16 )
local dxfont2_LCD - L = dxCreateFont ( ":zegary/LCD-L.ttf" , 10 )
local screenW , screenH = guiGetScreenSize ()
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 = string . format ( "%.1f" , getElementData ( v , "przeb" ))
local x , y , z = getElementPosition ( getLocalPlayer () )
local location = getZoneName ( x , y , z , true )
local wacha = string . format ( "%.1f" , getElementData ( v , "fuel" ))
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.4135 , screenH * 0.6852 , screenW * 0.5104 , screenH * 0.7759 , tocolor ( 247 , 92 , 0 , 255 ), 1.00 , dxfont0_LCD - L , "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.4141 , screenH * 0.7981 , screenW * 0.5203 , screenH * 0.8343 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont1_LCD - L , "center" , "center" , false , false , false , false , false )
dxDrawText ( "..tostring(przebieg).." , screenW * 0.4349 , screenH * 0.8907 , screenW * 0.4953 , screenH * 0.9269 , tocolor ( 247 , 92 , 0 , 255 ), 1.00 , dxfont1_LCD - L , "center" , "center" , false , false , false , false , false )
dxDrawText ( "..tostring(wacha).." , screenW * 0.4323 , screenH * 0.8472 , screenW * 0.5005 , screenH * 0.8759 , tocolor ( 254 , 254 , 254 , 255 ), 1.00 , dxfont2_LCD - L , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientRender" , getRootElement (), hud )
Debugscript wywala mi :
ERROR: Loading script failed: zegary/zegarynew.lua:3: unexpected symbol near "-"
Prosz? o pomoc, nie mam poj?cia dlaczego m?j kod nie dzia?a i nie wy?wietla zupe?nie nic.
Wysłany: 2016-07-14, 15:48
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4260 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
Testuj.
local dxfont0_LCD_L = dxCreateFont ( ":zegary/LCD-L.ttf" , 61 )
local dxfont1_LCD_L = dxCreateFont ( ":zegary/LCD-L.ttf" , 16 )
local dxfont2_LCD_L = dxCreateFont ( ":zegary/LCD-L.ttf" , 10 )
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-07-15, 12:12
flimbo123
Wiek: 33 Na forum: 5776 dni Posty: 93
Nick w MP: Flimbo
Piwa : 190
local font0 = dxCreateFont ( "LCD-L.ttf" , 50 )
local font1 = dxCreateFont ( "LCD-L.ttf" , 13 )
local font2 = dxCreateFont ( "LCD-L.ttf" , 18 )
local font3 = dxCreateFont ( "LCD-L.ttf" , 10 )
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 = string . format ( "%.1f" , 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).." , 839 , 721 , 1010 , 802 , tocolor ( 253 , 221 , 0 , 255 ), 1.00 , font0 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "km/h" , 1010 , 773 , 1053 , 802 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , font3 , "left" , "bottom" , false , false , false , false , false )
dxDrawText ( "..tostring(location).." , 839 , 802 , 1010 , 842 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , font1 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "..tostring(przebieg).." , 839 , 846 , 1010 , 883 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , font2 , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientRender" , getRootElement (), hud )
Kod dzia?a, ale nie wy?wietla zmiennych
Wysłany: 2016-07-15, 12:35
GabWas
Wiek: 24 Na forum: 3881 dni Posty: 289
Nick w MP: GabWas
Piwa : 65
Bo da?e? tostring'i w cudzys?owie...
Wysłany: 2016-07-15, 14:21
flimbo123
Wiek: 33 Na forum: 5776 dni Posty: 93
Nick w MP: Flimbo
Piwa : 190
Kurcze, faktycznie ?e te? takiej oczywistej rzeczy nie zauwa?y?em, dzi?ki wam.
Tagi: zegary :: cyfrowe
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: