The Server Writes Fuel.
The Client Only Reads It.
rde_fuel is a realistic LTD Gasoline-branded fuel system for ox_core — real nozzle and hose interaction with full multiplayer sync, server-authoritative fuel state that clients can never spoof, and spilled-fuel billing if you drop the nozzle mid-pour.
Overview
v1.0.0 is the first stable release — a full audit and rewrite pass over an earlier internal draft. Dead code removed, race conditions closed, every polling loop throttled to match RDE OX Development Standards v2.0.
Why this over other fuel scripts
| Other Fuel Scripts | rde_fuel |
|---|---|
| Client writes fuel state directly | Server is the sole writer |
| Fuel never converges to 100% | Local fill tracking + synchronous native read |
| No nozzle sync between players | Full multiplayer hose/nozzle sync via GlobalState |
| Spilled fuel = free fuel | Spilled-fuel billing — you pay for what hit the ground |
Quick Start
ensure oxmysql
ensure ox_lib
ensure ox_core
ensure ox_inventory
ensure rde_fuel
No SQL import needed. 27 gas station blips are pre-placed across the map — walk up, grab the nozzle, and go.
Multiplayer Sync
| What | How |
|---|---|
| Vehicle fuel level | Entity(vehicle).state.fuel — server-authoritative, replicated automatically |
| Nozzle + hose position | GlobalState['rde_fuel_nozzle_<serverId>'], broadcast every 200ms while held/inserted |
Other clients render a local, non-networked prop + rope from the broadcast data — no entity networking bandwidth needed.
The NUI Pump Display
Built to actually look like a pump display — brushed-metal cabinet, LTD Gasoline brand stripe, a recessed LCD window with real ghost-segment styling (unlit 7-segment shapes faintly visible behind active digits, like a real dispenser), live fill-percentage gauge, and a red flash warning banner on insufficient funds. Fully bilingual EN/DE, labels swap automatically.
Exports
exports.rde_fuel:SetVehicleFuel(netId, fuel) -- fuel: 0–100
exports.rde_fuel:GetVehicleFuel(netId) -- returns 0–100
Debug Commands
| Command | Description |
|---|---|
| setfuel [0-100] | Set current vehicle's fuel level instantly (testing) |
| getfuel | Print current vehicle's fuel level to console |
Most fuel/billing edge cases are easiest to reproduce by setting a low fuel level, then pumping and dropping the nozzle mid-pour.
Common Pitfalls
Fuel never reaches 100% / cost keeps climbing
Pre-1.0.0 bug — GetFuel() re-read the network-delayed StateBag mid-pour, but the StateBag only updates after payment, so the fill never converged.
Fix (v1.0.0): fill progress is now tracked locally for the duration of the pour; GetFuel() prefers the synchronous native fuel level.
Dropping the nozzle mid-pour doesn't charge for spillage
The wastingFuel flag was declared and consumed by the billing thread but never actually set to true anywhere.
Fix (v1.0.0): properly wired — dropping a held nozzle now starts the spill-billing loop and stops correctly on pickup/return.
Resource fails to start with a Config nil error
Config was declared local, making it invisible across files loaded via shared_scripts.
Fix (v1.0.0): Config is now a true global table.
FAQ
Are electric vehicles excluded automatically?
Yes — EVs (Voltic, Tezeract, Khamelion, Surge, etc.) are automatically excluded from fuel mechanics.
Is a jerry can supported?
Yes — buy, refill, and use a jerry can to fuel vehicles away from a pump.
Changelog — v1.0.0 Audit
Fueling-loop convergence fix, server-sole-writer fuel authority, spill billing wired correctly, full multiplayer nozzle/hose sync, every Wait(0) loop throttled.