Hey, i'm working on a fuel system but it doesn't work , can someone fix please ? thanks..
No errors in debugscript
fuelNumber = 100
for i, vehicle in ipairs(getElementsByType("vehicle")) do
setElementData(vehicle,"fuel",tonumber(fuelNumber))
end
function decreaseFuel(seat, door)
setTimer(function()
if ( seat == 0 ) and ( door == 0 ) then
local veh = getPedOccupiedVehicle(localPlayer)
if ( veh ) then
setElementData(veh,"fuel",tonumber(fuelNumber)-1)
addEventHandler("onClientRender",getRootElement(),onFuelRender)
end
end
end,1000,0)
end
addEventHandler("onClientVehicleEnter",getRootElement(),decreaseFuel)
function onFuelRender()
if isPedInVehicle ( localPlayer ) then
dxDrawText("Vehicle Fuel: "..tonumber(fuelNumber).."%", 312, 718, 561, 742, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, true, false, false)
end
end