--[[
©️ Copyright 2021, wszelkie prawa zastrze?one. Autor: Lucky
--]]
local sw,sh = guiGetScreenSize()
sx = function(value) return sw*value/1920 end
sy = function(value) return sh*value/1080 end
local screenW, screenH = guiGetScreenSize()
--local frequency = 1
addEventHandler('onClientResourceStart',root,function()
textures = {
['bg'] = dxCreateTexture('img/bg.png','argb',true,'clamp'),
['lgbt'] = dxCreateTexture('img/lgbt.png','argb',true,'clamp'),
['piesek'] = dxCreateTexture('img/piesek.png','argb',true,'clamp'),
['kizo'] = dxCreateTexture('img/kizo.png','argb',true,'clamp'),
['twojstary'] = dxCreateTexture('img/twojstary.png','argb',true,'clamp'),
['twojstaryrgb'] = dxCreateTexture('img/twojstaryrgb.png','argb',true,'clamp'),
['twojstary2rgb'] = dxCreateTexture('img/twojstary2rgb.png','argb',true,'clamp'),
['twojstary2'] = dxCreateTexture('img/twojstary2.png','argb',true,'clamp'),
['rgb'] = dxCreateTexture('img/rgb.png','argb',true,'clamp'),
['minionek'] = dxCreateTexture('img/minionek.png','argb',true,'clamp'),
['bg2'] = dxCreateTexture('img/bg2.png','argb',true,'clamp'),
['fuel'] = dxCreateTexture('img/fuel.png','argb',true,'clamp'),
['bateria'] = dxCreateTexture('img/bateria.png','argb',true,'clamp'),
['arrow'] = dxCreateTexture('img/arrow.png','argb',true,'clamp'),
['rower'] = dxCreateTexture('img/licznik_rower.png','argb',true,'clamp'),
['silnik'] = dxCreateTexture('img/engine.png','argb',true,'clamp'),
['lampa'] = dxCreateTexture('img/lights.png','argb',true,'clamp'),
['reczny'] = dxCreateTexture('img/hbrake.png','argb',true,'clamp'),
['font'] = dxCreateFont('normal.ttf',sx(19)),
['font5'] = dxCreateFont('normal.ttf',sx(12)),
['font6'] = dxCreateFont('normal.ttf',sx(14)),
['font7'] = dxCreateFont('normal.ttf',sx(11)),
['font4'] = dxCreateFont('kmh.ttf',sx(50)),
['font2'] = dxCreateFont('kmh.ttf',sx(90)),
}
end)
-- WZI?TE Z MTA WIKI --
function getVehicleSpeed()
if isPedInVehicle(getLocalPlayer()) then
local sx, sy, sz = getElementVelocity(getPedOccupiedVehicle(getLocalPlayer()))
return math.sqrt(( sx^2 + sy^2 + sz^2) ^(0.5)) *0.7*180*1.310
end
return 0
end
function getElementSpeed(theElement, unit)
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
local elementType = getElementType(theElement)
assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
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)")
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
return (Vector3(getElementVelocity(theElement)) * mult).length
end
--
function licznik_Lucky()
if not getElementData(localPlayer,'player:logged') then return end
local vehicle = getPedOccupiedVehicle(localPlayer)
if not isElement(vehicle) then return end
if getElementData(vehicle,"recznySalonData") then return end
local speedkmh = getElementSpeed(vehicle, 1)
local r,g,b = getVehicleHeadLightColor(vehicle)
local lgbt = getElementData(vehicle, "vehicle:lgbt") or 0
local piesek = getElementData(vehicle, "vehicle:piesek") or 0
local minionek = getElementData(vehicle, "vehicle:minionek") or 0
local rgb = getElementData(vehicle, "vehicle:rgb") or 0
local twojstary2rgb = getElementData(vehicle, "vehicle:twojstary2rgb") or 0
local twojstaryrgb = getElementData(vehicle, "vehicle:twojstaryrgb") or 0
local twojstary2 = getElementData(vehicle, "vehicle:twojstary2") or 0
local twojstary = getElementData(vehicle, "vehicle:twojstary") or 0
local rgb = getElementData(vehicle, "vehicle:rgb") or 0
if isPedInVehicle(localPlayer) then
veh = getPedOccupiedVehicle(localPlayer)
local speedkmh = getElementSpeed(vehicle, 1)
predkosc_ar =getElementSpeed(vehicle, 1)/1
if speedkmh > 296 then predkosc_ar = 296
end
end
local przebieg = getElementData(vehicle,'vehicle:mileage') or 0
local fuel = getElementData(vehicle,'vehicle:fuel')
local lpg = getElementData(vehicle,'gaz')
speedkmh = getElementSpeed(vehicle, 1)
speedkmh2 = speedkmh + 3
if getVehicleOverrideLights(vehicle) == 2 and lgbt == 0 and piesek == 0 and minionek == 0 and kizo == 0 and rgb == 0 and twojstary == 0 and twojstary2 == 0 and twojstary2rgb == 0 and twojstaryrgb == 0 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg2'],0,0,0,tocolor(r,g,b,255),false)
end
if lgbt == 1 then
local curtime = getTickCount() / 1000
r = math.floor(math.sin(curtime * lgbt + 0) * 127 + 128)
g = math.floor(math.sin(curtime * lgbt + 2) * 127 + 128)
b = math.floor(math.sin(curtime * lgbt + 4) * 127 + 128)
else
r, g, b = getVehicleHeadLightColor(vehicle)
end
if piesek == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['piesek'],0,0,0,tocolor(255,255,255,255),false)
end
if minionek == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['minionek'],0,0,0,tocolor(255,255,255,255),false)
end
if rgb == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['rgb'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
end
if kizo == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['kizo'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
end
if twojstary == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['twojstary'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
end
if twojstary2 == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['twojstary2'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
end
if twojstary2rgb == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['twojstary2rgb'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
end
if twojstaryrgb == 1 then
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['twojstaryrgb'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
end
dxDrawImage(sx(1520),sy(710),sx(380),sy(380),textures['bg'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1520),sy(730),sx(400),sy(400),textures['arrow'],predkosc_ar*0.75,0,0,tocolor(255,255,255,255),false)
if not getVehicleEngineState(vehicle) then
dxDrawImage(sx(1860),sy(785),sx(40),sy(40),textures['silnik'],0,0,0,tocolor(255,0,0,255),false)
else
dxDrawImage(sx(1860),sy(785),sx(40),sy(40),textures['silnik'],0,0,0,tocolor(255,255,255,255),false)
end
if getVehicleOverrideLights(vehicle) ~= 2 then
dxDrawImage(sx(1818),sy(740),sx(40),sy(40),textures['lampa'],0,0,0,tocolor(255,255,0,255),false)
else
dxDrawImage(sx(1818),sy(740),sx(40),sy(40),textures['lampa'],0,0,0,tocolor(255,255,255,255),false)
end
if isElementFrozen(veh) then
dxDrawImage(sx(1760),sy(715),sx(40),sy(40),textures['reczny'],0,0,0,tocolor(255,0,0,255),false)
else
dxDrawImage(sx(1760),sy(715),sx(40),sy(40),textures['reczny'],0,0,0,tocolor(255,255,255,255),false)
end
-- Paliwo & LPG --
if getElementData(vehicle,"vehicle:elektryk") == 1 then
dxDrawImage(sx(1390),sy(1000),sx(160),sy(70),textures['bateria'],0,0,0,tocolor(255,255,255,255),false)
dxDrawText(('%01d'):format(math.floor(fuel)).."%", (screenW * 0.6252) + 1, (screenH * 0.9640) + 1, (screenW * 0.9093) + 1, (screenH * 0.9713) + 1, tocolor(0, 0, 0, 255), 0.2, textures['font2'], "center", "center", false, false, true, false, false)
dxDrawText(('%01d'):format(math.floor(fuel)).."%", screenW * 0.6252, screenH * 0.9640, screenW * 0.9093, screenH * 0.9713, tocolor(255, 255, 255, 255), 0.2, textures['font2'], "center", "center", false, false, true, false, false)
else
if getElementData(vehicle,'vehicle:fuel') >= 10 then
dxDrawImage(sx(1390),sy(980),sx(125),sy(125),textures['fuel'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1390),sy(985),sx(130),sy(130),textures['arrow'],42+fuel*1.84,0,0,tocolor(255,255,255,255),false)
dxDrawText("PB", sx(2300)+1,sy(1430)+1,sx(612)+1,sy(612)+1, tocolor(0, 0, 0, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
dxDrawText("PB", sx(2300),sy(1430),sx(612),sy(612), tocolor(255, 255, 255, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
end
dxDrawImage(sx(1390),sy(980),sx(125),sy(125),textures['fuel'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1390),sy(985),sx(130),sy(130),textures['arrow'],42+fuel*1.84,0,0,tocolor(255,255,255,255),false)
dxDrawText("PB", sx(2300)+1,sy(1430)+1,sx(612)+1,sy(612)+1, tocolor(0, 0, 0, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
dxDrawText("PB", sx(2300),sy(1430),sx(612),sy(612), tocolor(255, 255, 255, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
end
if getElementData(vehicle, "Zamontowane:LPG") == "Tak" then
if getElementData(vehicle,'gaz') >= 10 then
dxDrawImage(sx(1390),sy(880),sx(125),sy(125),textures['fuel'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1390),sy(885),sx(130),sy(130),textures['arrow'],42+lpg*1.84,0,0,tocolor(255,255,255,255),false)
dxDrawText("LPG", sx(2300)+1,sy(1230)+1,sx(612)+1,sy(612)+1, tocolor(0, 0, 0, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
dxDrawText("LPG", sx(2300),sy(1230),sx(612),sy(612), tocolor(255, 255, 255, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
else
dxDrawImage(sx(1390),sy(880),sx(125),sy(125),textures['fuel'],0,0,0,tocolor(255,255,255,255),false)
dxDrawImage(sx(1390),sy(885),sx(130),sy(130),textures['arrow'],42+lpg*1.84,0,0,tocolor(255,255,255,255),false)
dxDrawText("LPG", sx(2300)+1,sy(1230)+1,sx(612)+1,sy(612)+1, tocolor(0, 0, 0, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
dxDrawText("LPG", sx(2300),sy(1230),sx(612),sy(612), tocolor(255, 255, 255, 255), 1, textures['font7'], "center", "center", true, true, true, true, true)
end
end
if getElementData(vehicle, "lpg:off") and getElementData(vehicle, "Zamontowane:LPG") == "Tak" then
dxDrawText("#00cc00•", sx(2330),sy(1430),sx(612),sy(612), tocolor(255, 255, 255, 255), 1.1, textures['font7'], "center", "center", true, true, true, true, true)
elseif not getElementData(vehicle, "lpg:off") and getElementData(vehicle, "Zamontowane:LPG") == "Tak" then
dxDrawText("#00cc00•", sx(2340),sy(1230),sx(612),sy(612), tocolor(255, 255, 255, 255), 1.1, textures['font7'], "center", "center", true, true, true, true, true)
end
-- Reszta rzeczy --
if speedkmh < 10 then
dxDrawText(string.format('%01d',math.floor(speedkmh)).."",sx(1550)+1,sy(960)+1,sx(1872)+1,sy(612)+1, tocolor(0, 0, 0, 255), 0.7, textures['font2'], "right", "top", true, true, true, true, true)
dxDrawText(string.format('%01d',math.floor(speedkmh)).."",sx(1550),sy(960),sx(1872),sy(612) , tocolor(255, 255, 255, 255), 0.7, textures['font2'], "right", "top", true, true, true, true, true)
else
dxDrawText(string.format('%01d',math.floor(speedkmh2)).."",sx(1550)+1,sy(960)+1,sx(1872)+1,sy(612)+1, tocolor(0, 0, 0, 255), 0.7, textures['font2'], "right", "top", true, true, true, true, true)
dxDrawText(string.format('%01d',math.floor(speedkmh2)).."",sx(1550),sy(960),sx(1872),sy(612) , tocolor(255, 255, 255, 255), 0.7, textures['font2'], "right", "top", true, true, true, true, true)
end
dxDrawText(""..string.format('%01d',math.floor(przebieg)).." km", sx(2820)+1,sy(1080)+1,sx(612)+1,sy(612)+1, tocolor(0, 0, 0, 255), 1, textures['font6'], "center", "center", true, true, true, true, true)
dxDrawText(""..string.format('%01d',math.floor(przebieg)).." km", sx(2820),sy(1080),sx(612),sy(612), tocolor(255, 255, 255, 255), 1, textures['font6'], "center", "center", true, true, true, true, true)
end
addEventHandler('onClientRender',root,licznik_Lucky)
function RGBToHex(red, green, blue, alpha)
if ( (red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255) ) ) then
return nil
end
if ( alpha ) then
return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha)
else
return string.format("#%.2X%.2X%.2X", red,green,blue)
end
end