--if (getPlayerName(localPlayer)=="maciek00") or (getPlayerName(localPlayer)=="Parachute") then
local sx,sy=guiGetScreenSize()
local czc=dxCreateFont("cz.ttf", ((sx+sy)/2)*0.01)
local czc2=dxCreateFont("cz.ttf", ((sx+sy)/2)*0.03)
local czc3=dxCreateFont("i/LCD.ttf", ((sx+sy)/2)*0.008)
local czc4=dxCreateFont("i/LCD.ttf", ((sx+sy)/2)*0.012)
local czc5=dxCreateFont("i/LCD.ttf", ((sx+sy)/2)*0.012)
local spd_last=0
local wielkosc=0.210
local wielkosc1=0.330
local wlaczony=true
local alpha = 220
local bezlicznika={}
bezlicznika[509]=true -- "Bike"
bezlicznika[481]=true -- "BMX"
bezlicznika[510]=true -- "Mountain Bike"
function getElementSpeed(theElement, unit)
-- Check arguments for errors
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")")
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
-- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
-- Setup our multiplier to convert the velocity to the specified unit
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
-- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
return (Vector3(getElementVelocity(theElement)) * mult).length
end
--guiCreateStaticImage(sx-(sx*wielkosc), (sy-((sx*wielkosc)*0.73))+1, sx*wielkosc, (sx*wielkosc)*0.73, "i/tarcza.png",false)
local dxdraw=(
function()
local veh=getPedOccupiedVehicle(localPlayer)
if not veh then
spd_last=0
return
end
if not wlaczony then
return
end
if not getElementData(veh, "licznik:nowy") then
return
end
if getElementData(localPlayer, "camera:fade") then
return
end
if bezlicznika[getElementModel(veh)] then
return
end
local time = getRealTime ()
if time.hour > 9 then
time.hour = time.hour
else
time.hour = "0"..time.hour
end
if time.minute > 9 then
time.minute = time.minute
else
time.minute = "0"..time.minute
end
local spd=getElementSpeed(veh,"km/h")
spd_last=(spd_last+spd)/2
local przebieg=getElementData(veh,"przebieg")
local nalot=getElementData(veh,"nalot")
local bak=getElementData(veh,"bak") or 0
local paliwo=getElementData(veh,"paliwo") or 0
if (getVehicleType(veh)=="Bike") then
if przebieg then
if tonumber(przebieg) then
dxDrawText(string.format("%.1fkm", przebieg), 0, sy-30, sx-100, 0, tocolor(255,255,255,255), 1, czc, "right")
--dxDrawText(string.format("%.1f", przebieg), 0, sy-227+203, sx-400+170, 0, tocolor(255,255,255,255), 1, czc, "right") -----768------744----794
end
end
if (paliwo<=(bak*0.2)) then
dxDrawText(string.format("%.1f/%.1fl", paliwo,bak), 0, sy-120, sx-50, 0, tocolor(255,255,0,255), 1, czc, "right")
else
dxDrawText(string.format("%.1f/%.1fl", paliwo,bak), 0, sy-120, sx-50, 0, tocolor(255,255,255,255), 1, czc, "right")
end
dxDrawText(string.format("%dkm/h", spd_last), 0, sy-100, sx-50, 0, tocolor(255,255,255,255), 1, czc2, "right")
if (getVehicleOverrideLights(veh) == 2) then
dxDrawImage(sx-85,sy-150, 35, 28, "i/swiatla.png")
--dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.34,sy-((sx*wielkosc)*0.63)+((sx*wielkosc)*0.435), (sx*wielkosc)*0.0775, (sx*wielkosc)*0.0625, "i/swiatla.png")
--dxDrawImage(sx-400+136, sy-227+174, 31, 25, "i/swiatla.png")
--dxDrawImage(sx-(sx*wielkosc)+((sx*wielkosc)*0.3475), sy-((sx*wielkosc)*0.63)+(sx*wielkosc)*0.45, 23, 13, "i/swiatla.png")
end
if isElementFrozen(veh) then
dxDrawImage(sx-125,sy-150, 35, 28, "i/reczny.png")
--dxDrawImage(sx-400+113, sy-227+175, 30, 23, "i/reczny.png")
--dxDrawImage(sx-400+118, sy-227+180, 18, 15, "i/reczny.png")
end
if not getVehicleEngineState(veh) then
dxDrawImage(sx-165,sy-150, 35, 28, "i/silnik.png")
--dxDrawImage(sx-400+90, sy-227+173, 30, 24, "i/silnik.png")
--dxDrawImage(sx-400+94, sy-227+179, 20, 15, "i/silnik.png")
end
else
dxDrawImage(sx-(sx*wielkosc),sy-((sx*wielkosc1)*0.63),(sx*wielkosc),((sx*wielkosc1)*0.63),"i/licznik_bez_tla.png",0,0,0,tocolor(255,255,255,alpha))
--dxDrawImage(sx-400,sy-227,400,227,"i/licznik_bez_tla.png",0,0,0,tocolor(255,255,255,255))
--dxDrawText(spd_last, sx, sy-100, 0, 0, tocolor(255,255,255,255),1, czc, 'center')
--dxDrawImage(sx-(sx*wielkosc), (sy-((sx*wielkosc)*0.73))+1, sx*wielkosc, (sx*wielkosc)*0.73, "i/tarcza.png")
----dxDrawImage(sx-((sx*wielkosc)*0.39)-(((sx*wielkosc)*0.04)/2), sy-(((sx*wielkosc)*0.73)*0.15)-((sx*wielkosc)*0.48), (sx*wielkosc)*0.07, (sx*wielkosc)*0.48, "i/strzalka.png", (spd_last*1.5)+45)
if (getVehicleOverrideLights(veh) == 2) then
dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.6335,sy-((sx*wielkosc)*0.86)+(sx*wielkosc)*0.505, (sx*wielkosc)*0.0645, (sx*wielkosc)*0.05, "i/swiatla.png",0,0,0,tocolor(255,255,255,alpha))
--dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.34,sy-((sx*wielkosc)*0.63)+((sx*wielkosc)*0.435), (sx*wielkosc)*0.0775, (sx*wielkosc)*0.0625, "i/swiatla.png")
--dxDrawImage(sx-400+136, sy-227+174, 31, 25, "i/swiatla.png")
--dxDrawImage(sx-(sx*wielkosc)+((sx*wielkosc)*0.3475), sy-((sx*wielkosc)*0.63)+(sx*wielkosc)*0.45, 23, 13, "i/swiatla.png")
end
if isElementFrozen(veh) then
dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.46, sy-((sx*wielkosc)*0.789)+(sx*wielkosc)*0.505, (sx*wielkosc)*0.08,(sx*wielkosc)*0.0625, "i/reczny.png",0,0,0,tocolor(255,255,255,alpha))
--dxDrawImage(sx-400+113, sy-227+175, 30, 23, "i/reczny.png")
--dxDrawImage(sx-400+118, sy-227+180, 18, 15, "i/reczny.png")
end
if not getVehicleEngineState(veh) then
dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.567, sy-((sx*wielkosc)*0.810)+(sx*wielkosc)*0.502, (sx*wielkosc)*0.0705,(sx*wielkosc)*0.055, "i/silnik.png",0,0,0,tocolor(255,255,255,alpha))
--dxDrawImage(sx-400+90, sy-227+173, 30, 24, "i/silnik.png")
--dxDrawImage(sx-400+94, sy-227+179, 20, 15, "i/silnik.png")
end
if not getElementData(localPlayer,"interfejs:pasy") then
dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.358, sy-((sx*wielkosc)*0.815)+(sx*wielkosc)*0.5, (sx*wielkosc)*0.050, (sx*wielkosc)*0.07, "i/pasy.png",0,0,0,tocolor(255,255,255,alpha))
--dxDrawImage(sx-400+165, sy-227+179, 12, 15, "i/pasy.png")
end
bak=bak*10
paliwo=paliwo*10
paliwo=paliwo/(bak/100)
if bak and paliwo then
if bak>0 and tonumber(paliwo) then
if (paliwo<=20) then
dxDrawImage(sx-(sx*wielkosc)+((sx*wielkosc)*0.2965), sy-((sx*wielkosc)*0.845)+((sx*wielkosc)*0.49), (sx*wielkosc)*0.05, (sx*wielkosc)*0.05, "i/fuel.png",0,0,0,tocolor(255,255,255,alpha))
end
dxDrawImage(sx-(sx*wielkosc)+(sx*wielkosc)*0.488, sy-((sx*wielkosc)*0.844)+((sx*wielkosc)*0.1075), (sx*wielkosc)*0.015,(sx*wielkosc)*0.48, "i/strzalka_p.png", 243-paliwo*(-2.340),0,0,tocolor(255,255,255,alpha))
--dxDrawImage(sx-400+293, sy-227+106, 27, 167, "i/strzalka.png", 100-paliwo)
end
end
--bak=bak/(bak/100)
if przebieg then
if tonumber(przebieg) then
dxDrawText(string.format("%.0f", przebieg), sx-(sx*wielkosc)+((sx*wielkosc)*0.243), sy-((sx*wielkosc)*0.9538)+((sx*wielkosc)*0.46), sx-(sx*wielkosc)+((sx*wielkosc)*0.565), 0, tocolor(255,255,255,alpha), 1, czc3,"right")
--dxDrawText(string.format("%.1f", przebieg), 0, sy-227+203, sx-400+170, 0, tocolor(255,255,255,255), 1, czc, "right") -----768------744----794
end
end
if nalot then
if tonumber(nalot) then
nalotH=math.floor(nalot/60)
nalotM=nalot-(nalotH*60)
if (string.len(nalotM)==1) then
nalotM="0"..nalotM
end
dxDrawText(string.format("%dH %sM", nalotH, nalotM), 0, sy-((sx*wielkosc)*0.63)+((sx*wielkosc)*0.46), sx-(sx*wielkosc)+((sx*wielkosc)*0.525), 0, tocolor(255,255,255,255), 1, czc, "right")
end
end
local times = time.hour..":"..time.minute
dxDrawImage(sx-(sx*wielkosc)+((sx*wielkosc)*0.487),sy-((sx*wielkosc)*0.858)+(sx*wielkosc)*0.0035,(sx*wielkosc)*0.020,(sx*wielkosc)*0.7326,"i/strzalka.png",228+(spd_last*0.805),0,0,tocolor(255,255,255,alpha))
dxDrawText(string.format("%.0f",spd_last), sx-(sx*wielkosc)+((sx*wielkosc)*0.4730), sy-((sx*wielkosc)*0.9072)+((sx*wielkosc)*0.46), sx-(sx*wielkosc)+((sx*wielkosc)*0.559), 0, tocolor(255,255,255,alpha), 1, czc4,"right")
dxDrawText(times, sx-(sx*wielkosc)+((sx*wielkosc)*0.4090), sy-((sx*wielkosc)*1.107)+((sx*wielkosc)*0.46), sx-(sx*wielkosc)+((sx*wielkosc)*0.525), 0, tocolor(255,255,255,alpha), 1, czc5)
end
--dxDrawImage(sx-(sx*wielkosc)+(sx*0.089),sy-((sx*wielkosc)*0.63)+((sx*wielkosc)*0.025),(sx*wielkosc)*0.1,(sx*wielkosc)*0.6325,"i/strzalka.png",232+(spd_last*0.855),0,0,tocolor(255,255,255,255))
--dxDrawImage(sx-400+116,sy-227+10,46,253,"i/strzalka.png",232+(spd_last*0.855),0,0,tocolor(255,255,255,255))
--[[
dxDrawImage(sx-((sx*wielkosc)*0.39)-(((sx*wielkosc)*0.04)/2), sy-((sx*wielkosc)*0.36)-(((sx*wielkosc)*0.48)/2), (sx*wielkosc)*0.07, (sx*wielkosc)*0.48, "i/strzalka.png", (spd_last*1.5)+45)
]]--
--dxSetAspectRatioAdjustmentEnabled (true,16/9)
end
)
addEventHandler("onClientRender", root, dxdraw)
--38x248
--315,5 x 193
--48 x 7
--22 x 63 -- ?rodek wskaz?wki paliwa, a wi?c 0.78
local wylaczanie=(
function()
if not getElementData(localPlayer,"dbid") then
exports["es-komunikaty"]:komunikat("Najpierw si? zaloguj.")
return
end
if wlaczony then
wlaczony=false
else
wlaczony=true
end
end
)
addCommandHandler("pokazlicznik",wylaczanie)
addCommandHandler("ukryjlicznik",wylaczanie)
--end
--end