Commands#
Fuel Stations registers two commands. Both are restricted to players with creator access (see Installation); fuelmarket also runs from the server console.
Command | Where | Description |
|---|---|---|
| In game | Opens the station creator: stations, pumps and the Economy tab. The name is |
| In game · console | Prints each grade's market factor, trend and resulting base price. Only answers when |
| In game · console | Moves the market one step now, saves it, sends it to every player, then prints the new prices. |
> fuelmarket
Petrol: x1.012 (up) -> €5.06
Diesel: x0.987 (down) -> €9.87
Electric: x1.000 (flat) -> €5.00To open the creator with a key, set Config.Creator.keybind (for example 'F7'). It is registered as a FiveM key mapping, so each admin can change it in Settings → Key Bindings → FiveM.
Client Exports#
For reading and setting fuel from your own scripts — a garage, a HUD, a mechanic job, a phone app. Fuel is always a percentage of the tank, from 0 to 100.
GetFuel
Returns the vehicle's fuel level, 0–100. Returns 0 if the vehicle does not exist.
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local fuel = exports['qs-fuelstations']:GetFuel(vehicle)
print(('Tank at %.1f%%'):format(fuel))SetFuel
Sets the vehicle's fuel level. The value is clamped to 0–100 and replicated through the fuel state bag, so it sticks even when another player is the one driving.
-- A garage restoring the level it saved
exports['qs-fuelstations']:SetFuel(vehicle, storedFuel)
-- A mechanic job filling the tank
exports['qs-fuelstations']:SetFuel(vehicle, 100.0)GetVehicleFuelType
Returns the grade the vehicle takes — 'petrol', 'diesel' or 'electric' — as set in Economy → Vehicles. Anything not listed is petrol.
if exports['qs-fuelstations']:GetVehicleFuelType(vehicle) == 'electric' then
-- show a battery icon instead of a fuel pump
endGetVehicleFuelCapacity
Returns the size of the tank in litres, or of the battery in kWh, read from the vehicle's handling (fPetrolTankVolume). Falls back to 50 L, or 65 kWh for an EV.
local capacity = exports['qs-fuelstations']:GetVehicleFuelCapacity(vehicle)
local litres = exports['qs-fuelstations']:GetFuel(vehicle) / 100 * capacitygetFuelStations
Returns every station with its position, live prices and stock — built for phone apps and maps. A station that sells fuel and electricity appears once as gas and once as charge.
local data = exports['qs-fuelstations']:getFuelStations()
for _, station in ipairs(data.stations) do
-- station.id 'gas_12' or 'charge_12'
-- station.type 'gas' | 'charge'
-- station.name 'Gas Station 12'
-- station.x, .y, .z
-- station.level stock, 0-100 (always 100 for chargers)
-- station.prices { petrol = 5.06, diesel = 9.87 }
end
print(data.counts.gas, data.counts.charge, data.counts.total)
print(data.priceSymbol, data.prices.petrol)setFuelWaypoint
Sets the map waypoint. Returns false if the coordinates are not numbers.
exports['qs-fuelstations']:setFuelWaypoint(station.x, station.y)The Fuel State Bag#
Every networked vehicle carries its fuel level in the fuel state bag, updated whenever it changes by 1% or more. Any client and the server can read it without asking the driver:
-- Read it — client or server
local fuel = Entity(vehicle).state.fuel
-- Set it from the server — the client in control of the vehicle applies it
Entity(vehicle).state:set('fuel', 50.0, true)Writing the state bag from the server is the way to set fuel when there is no client script involved — a server-side garage, an admin command, a reward.
LegacyFuel Compatibility#
Scripts written for LegacyFuel call exports['LegacyFuel']:GetFuel and SetFuel. Fuel Stations answers those calls itself, so they keep working unchanged:
-- Still works, and reads the same tank as qs-fuelstations
local fuel = exports['LegacyFuel']:GetFuel(vehicle)
exports['LegacyFuel']:SetFuel(vehicle, 100.0)The first call prints a one-time warning in the client console suggesting the qs-fuelstations exports instead. It is a reminder, not an error.
Client Events#
Event | Arguments | Description |
|---|---|---|
|
| Shows a notification through the script's own notification bridge. |
Every other event in the resource is internal — payments, stock and deliveries are validated on the server, which checks distances and timings, so they are not meant to be triggered from outside.



