RDE_FUEL DOCS
RED DRAGON ELITE // ECONOMY & GAMEPLAY

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.

01 / Start Here

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.

Core Principle The fuel StateBag on every vehicle is written only by the server. Clients read it, never spoof it — the client tracks fill progress locally during a pour purely for display convergence.

Why this over other fuel scripts

Other Fuel Scriptsrde_fuel
Client writes fuel state directlyServer is the sole writer
Fuel never converges to 100%Local fill tracking + synchronous native read
No nozzle sync between playersFull multiplayer hose/nozzle sync via GlobalState
Spilled fuel = free fuelSpilled-fuel billing — you pay for what hit the ground
02 / Start Here

Quick Start

server.cfg
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.

03 / Reference

Multiplayer Sync

WhatHow
Vehicle fuel levelEntity(vehicle).state.fuel — server-authoritative, replicated automatically
Nozzle + hose positionGlobalState['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.

04 / Reference

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.

05 / Reference

Exports

Server exports
exports.rde_fuel:SetVehicleFuel(netId, fuel)   -- fuel: 0–100
exports.rde_fuel:GetVehicleFuel(netId)         -- returns 0–100
06 / Reference

Debug Commands

CommandDescription
setfuel [0-100]Set current vehicle's fuel level instantly (testing)
getfuelPrint 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.

07 / More

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.

08 / More

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.

09 / More

Changelog — v1.0.0 Audit

v1.0.0

Fueling-loop convergence fix, server-sole-writer fuel authority, spill billing wired correctly, full multiplayer nozzle/hose sync, every Wait(0) loop throttled.