Fuel scripts
The leaking fuel tank lowers the real fuel level of your fuel script, so its HUD, pumps and saved level stay right. It goes through bridge/fuel/client.lua (open when escrowed).
Supported out of the box
With Config.Fuel.System = 'auto', the first running of these is used:
| Resource | How |
|---|---|
lc_fuel |
Its fuel decor / GetFuel / SetFuel exports. |
ox_fuel |
The vehicle state bag fuel. |
LegacyFuel |
GetFuel / SetFuel exports. |
cdn-fuel |
GetFuel / SetFuel exports. |
ps-fuel |
GetFuel / SetFuel exports. |
lj-fuel |
GetFuel / SetFuel exports. |
okokGasStation |
GetFuel / SetFuel exports. |
qs-fuelstations |
GetFuel / SetFuel exports. |
None running = GTA's own fuel level (GetVehicleFuelLevel / SetVehicleFuelLevel). To always use GTA's level, set Config.Fuel.System = 'game'.
The fuel script is looked up again every 10 seconds, so one that starts after Impact Dynamics is still picked up. A resource named in Config.Fuel.System that is not started falls back to GTA's level until it starts.
Any other fuel script
Has GetFuel(vehicle) / SetFuel(vehicle, value) exports? Just name it:
Config.Fuel.System = 'my-fuel'
Different exports? Add an entry to SYSTEMS in bridge/fuel/client.lua, and its name to AUTO_ORDER if 'auto' should find it:
SYSTEMS['my-fuel'] = {
get = function(veh, res) -- return 0-100
return exports[res]:getVehicleFuel(veh)
end,
set = function(veh, value, res)
exports[res]:setVehicleFuel(veh, value)
end,
}
A script with the LegacyFuel-style exports only needs its name added to LEGACY_STYLE.
Electric cars
Electric cars never leak. If your fuel script has an IsVehicleElectric(vehicle) export it is asked first (so its own EV list counts); otherwise GTA's electric flag is used.
Wrong fuel / ruined engine
If your fuel script marks a ruined engine (e.g. wrong fuel) with a vehicle state bag, name it so the engine guard lets the engine die instead of holding it up:
Config.Fuel.EngineKilledStateBag = 'wrongFuel' -- Entity(vehicle).state.wrongFuel == true