Fuel Systems
Advanced Bus Job sets the job bus fuel once when the vehicle spawns. The amount comes from:
Config.Vehicle.spawnFuel = 100.0Set the integration in config/shared.lua:
Config.Integrations.fuel = 'auto'Built-in integrations
Section titled “Built-in integrations”Auto-detection checks this order; the first started resource wins:
| Resource | API used | Side |
|---|---|---|
ox_fuel |
replicated Entity(vehicle).state.fuel, plus native fuel level |
Server + client |
LegacyFuel |
exports['LegacyFuel']:SetFuel(vehicle, amount) |
Client |
ps-fuel |
exports['ps-fuel']:SetFuel(vehicle, amount) |
Client |
cdn-fuel |
exports['cdn-fuel']:SetFuel(vehicle, amount) |
Client |
Renewed-Fuel |
replicated fuel state bag, plus native fuel level |
Server + client |
lc_fuel |
exports['lc_fuel']:SetFuel(vehicle, amount) |
Client |
lj-fuel |
exports['lj-fuel']:SetFuel(vehicle, amount) |
Client |
LegacyFuel-compatible integrations use a client export named SetFuel(vehicle, amount). Each implementation lives in an open file under custom/fuel/; if your installed fork behaves differently, edit its adapter or use the custom fuel adapter.
Official references:
- ox_fuel — get/set fuel
- LegacyFuel — client exports
- ps-fuel — official project
- cdn-fuel — official manifest exports
- Renewed-Fuel — exports
Setup examples
Section titled “Setup examples”ox_fuel
Section titled “ox_fuel”ensure ox_fuelensure lx-busjobConfig.Integrations.fuel = 'auto' -- or 'ox_fuel'ox_fuel uses a state bag rather than a SetFuel export. Advanced Bus Job handles this explicitly and replicates the initial fuel value.
LegacyFuel / ps-fuel / cdn-fuel
Section titled “LegacyFuel / ps-fuel / cdn-fuel”ensure ps-fuelensure lx-busjobConfig.Integrations.fuel = 'ps-fuel'Replace ps-fuel with the exact resource folder name. Resource names are case-sensitive.
Custom fuel script
Section titled “Custom fuel script”Set the slot to custom:
Config.Integrations.fuel = 'custom'Then edit the open custom/fuel/custom.lua:
-- custom/fuel/custom.luaLxBusIntegrations.Register('fuel', 'custom', { setFuel = function(vehicle, amount) exports['my_fuel']:SetVehicleFuel(vehicle, amount) end,})The hook runs client-side once when the bus spawns:
| Argument | Type | Meaning |
|---|---|---|
vehicle |
number |
Local vehicle entity handle |
amount |
number |
Fuel percentage from Config.Vehicle.spawnFuel (0.0–100.0) |
The adapter is called through a protected registry. If it errors, the console reports the exact adapter/function and the script still applies FiveM’s native vehicle fuel level.
Alternatively, copy a neighboring adapter (for example custom/fuel/ps-fuel.lua), rename the file and registration name to your resource, then set Config.Integrations.fuel to that exact resource name.
Disable fuel integration
Section titled “Disable fuel integration”Config.Integrations.fuel = 'none'The bus still receives the configured native fuel level, but no external fuel script is called.
Troubleshooting
Section titled “Troubleshooting”- Ensure the fuel resource starts before
lx-busjob - Check the integration line printed after resource start
- Confirm the resource folder name and letter casing
- If the bus always spawns at the external script’s default fuel, that script probably uses a different setter—use the custom hook