1
0
Fork 0
forked from Simnation/Main
Main/resources/[carscripts]/AdvancedParking/client/cl_integrations.lua
2025-08-07 14:38:30 +02:00

33 lines
1 KiB
Lua

-- get vehicle fuel level
function GetFuelLevel(vehicle)
if (GetResourceState("LegacyFuel") == "started") then
return exports["LegacyFuel"]:GetFuel(vehicle)
elseif (GetResourceState("ox_fuel") == "started") then
return Entity(vehicle).state.fuel or GetVehicleFuelLevel(vehicle)
elseif (GetResourceState("myFuel") == "started") then
return exports["myFuel"]:GetFuel(vehicle)
else
return GetVehicleFuelLevel(vehicle)
end
end
-- set vehicle fuel level
function SetFuelLevel(vehicle, fuelLevel)
if (GetResourceState("LegacyFuel") == "started") then
exports["LegacyFuel"]:SetFuel(vehicle, fuelLevel)
elseif (GetResourceState("ox_fuel") == "started") then
Entity(vehicle).state.fuel = fuelLevel
elseif (GetResourceState("myFuel") == "started") then
exports["myFuel"]:SetFuel(vehicle, fuelLevel)
else
SetVehicleFuelLevel(vehicle, fuelLevel)
end
end
-- notification (only used for the delete timer)
function ShowNotification(text)
SetNotificationTextEntry('STRING')
AddTextComponentSubstringPlayerName(text)
return DrawNotification(false, true)
end