fuel is not getting low, please help me guys
SurvivorSystem_client.lua
local sx,sy = guiGetScreenSize()
local x,y,z = getElementPosition(getLocalPlayer())
for i,veh in ipairs(getElementsByType("vehicle")) do
local px,py,pz = getElementPosition (veh)
local vehID = getElementModel(veh)
local vehicle = getPedOccupiedVehicle(getLocalPlayer())
if veh ~= vehicle then
if vehID ~= 548 then
local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
if pdistance <= 6 then
--Get screenposition
local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 )
if sx and sy then
--Draw Vehicle
local w = dxGetTextWidth(getVehicleName(veh),1.02,"default-bold")
dxDrawText ( getVehicleName(veh), sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )
end
end
end
end
end
--Vehicle Infos
local veh = getPedOccupiedVehicle (getLocalPlayer())
if veh then
local alan = getElementData(veh,"parent")
if alan then
local maxfuel = getElementData(alan,"maxfuel") or 0
local fuel = getElementData(alan,"fuel") or 0
local needengine = (getElementData(alan,"needengines") or 1)
local needtires = (getElementData(alan,"needtires") or 4)
local needparts = (getElementData(alan,"needparts") or 1)
local engine = getElementData(alan,"Engine_inVehicle") or 0
local tires = getElementData(alan,"Tire_inVehicle") or 0
local parts = getElementData(alan,"Parts_inVehicle") or 0
local enginerenk =(engine == needengine and tocolor(0,255,0,220) or tocolor(255,0,0,220))
local tiresrenk = (tires == needtires and tocolor(0,255,0,220) or tocolor(255,0,0,220))
local partsrenk = (parts == needparts and tocolor(0,255,0,220) or tocolor(255,0,0,220))
dxDrawText (engine.."/"..needengine.." Engine" ,0,0,sx,sy,enginerenk,1,"default-bold", "center", "top" )
dxDrawText (tires.."/"..needtires.." Tires",0,13,sx,sy,tiresrenk,1,"default-bold", "center", "top" )
dxDrawText (parts.."/"..needparts.." Tank Parts",0,24,sx,sy,partsrenk,1,"default-bold", "center", "top" )
if fuel == maxfuel then
r,g,b = 0,255,0
elseif fuel < maxfuel/10 then
r,g,b = 255,0,0
elseif fuel < maxfuel/4 then
r,g,b = 255,50,0
elseif fuel < maxfuel/3 then
r,g,b = 200,100,0
elseif fuel < maxfuel/2 then
r,g,b = 125,200,0
elseif fuel < maxfuel/1.5 then
r,g,b = 50,200,0
end
dxDrawText ("Fuel:"..math.floor(fuel).."/"..maxfuel,0,36,sx,sy,tocolor( r,g,b, 220),1,"default-bold", "center", "top" )
end
end
if not playerTarget then return end
local x,y,z = getElementPosition(playerTarget)
local x,y,distance = getScreenFromWorldPosition (x,y,z+0.5)
distance = 20
if getElementData(playerTarget,"bandit") then
text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' ).." (Bandit)"
else
text = string.gsub(getPlayerName(playerTarget), '#%x%x%x%x%x%x', '' )
end
local w = dxGetTextWidth(text,distance*0.033,"default-bold")
dxDrawText (text,x-(w/2),y,x-(w/2), y, tocolor ( 100, 255, 100, 200 ), distance*0.033, "default-bold" )