Installation ​
Requirements ​
- A recent FiveM server artifact (Lua 5.4)
- oxmysql
- np_prophandler 1.1.0+: the EV charger props (streamed, not networked) with their charge option, and the nozzle in the hand. It must start before np_fuel
- Node 18+ to build the NUI once
Optional, auto-detected at start:
| Kind | Resources | Used for |
|---|---|---|
| Framework | es_extended, qbx_core, qb-core | Character identifier and name, cash and bank, jobs, society accounts, owned vehicles. Without one, np_fuel runs standalone with no economy (see Bridges) |
| Inventory | np_inventory, ox_inventory, qb-inventory | The jerrycan and fuel_receipt items. Without one, there are no receipts and no jerry can |
| Payments | np_payments | The checkout sheet for every payment. Without it, framework money (bank, then cash) |
| HUD | np_hud | Toasts, prompts, progress bars and the fuel tile. Without it, np_fuel's own layer and fuel gauge |
| Phone | np_phone | The Fuel app, owner and staff notifications, mails to offline owners |
| Menu | np_menu, ox_target, qb-target | Target options on the pump models. Without one, key prompts (E) |
| Staff | np_admin | Permission nodes, live settings, the audit log and staff tools. Without it, a fallback decides who is staff |
| Licences | np_identification | Truck licence and hazmat document for tanker runs. Without it, the checks pass |
| Characters | np_character | Character id and name |
| Shops | np_shops | Each station and its forecourt shop as one business, and pay inside at the counter. Without it, every station stands alone |
| Others | np_discord | Staff by Discord role |
| Zones | np_colshape | Enter and exit of the interaction points as colshapes. Needed on FiveM Legacy only, GTAV Enhanced has the natives built in. Without it, distance checks as before |
At start the server console prints one line per sibling: active, fallback (…) or missing export <name>.
Steps ​
- Put the resource in
resources/asnp_fuel. The NUI callbacks usehttps://np_fuel/…and other resources callexports.np_fuel, so keep the name. - Build the NUI:shThis creates
cd web && npm ci && npm run buildweb/dist/index.html(every screen) andweb/dist/phone.html(the np_phone app).web/distis not committed, so a fresh clone starts with a blank UI until you build it. - Database: the
fuel_*tables are created at start. To create them by hand, runsql/install.sql. The stations are seeded fromshared/config/02_stations.luaon the first start; after that the database is the truth (edit them in the station editor). - Add to
server.cfg. The framework and the inventory are detected once, at start, so start them before np_fuel. np_prophandler is a dependency and starts before np_fuel too:cfgensure oxmysql ensure np_prophandler ensure es_extended # or qbx_core / qb-core ensure np_inventory # or ox_inventory / qb-inventory ensure np_payments # optional siblings before np_fuel ensure np_hud ensure np_phone ensure np_menu ensure np_admin ensure np_identification ensure np_character ensure np_discord ensure np_fuel - Remove other fuel resources (LegacyFuel, ox_fuel, cdn-fuel, ps-fuel, …). np_fuel answers their exports itself, see Bridges → Other fuel resources.
- ox_inventory or qb-inventory: add the items. np_inventory gets them at runtime.
- Configure
shared/config/(Configuration), then walk through Before you open it.
Start order of the siblings
The optional np_* siblings may also start later or restart: np_fuel checks them when it calls them, and registers its
phone app again when np_phone restarts. np_prophandler must start before np_fuel; when it restarts, np_fuel registers
the charger props again on np_prophandler:ready. np_hud picks its fuel source lazily (again whenever a fuel resource starts), so its
order does not matter. An older np_hud build without np_fuel support picks once at start: start np_fuel before it.
np_shops
np_shops may start before or after np_fuel. The linked shops pair up 3 s after np_shops starts (and again on every np_shops restart); while np_shops is stopped, no station is linked. np_shops' own pump shops step aside while np_fuel runs, so every pump has one prompt.
Permissions ​
np_fuel uses no ACE and puts nothing into server.cfg for staff. With np_admin running,
grant these nodes to an np_admin group or a single player (or np_fuel.*):
| Node | Grants |
|---|---|
np_fuel.admin |
Staff commands, the network overview, /fuelinfo, any station |
np_fuel.editor |
The station editor: move, rename and rebrand stations; place fill points, offices, depots and chargers; create and remove stations |
np_fuel.setfuel |
/setfuel and the np_admin staff tool Set fuel on a player's vehicle |
np_fuel.stations |
Prices, stock, owners and balances of every station (also brand stations) |
Without np_admin, a player is staff for every node when one of these says so:
- one of their identifiers is in
Config.Admins('license:…','discord:…'); - the framework's admin groups in
Config.AdminGroups: ESX groupsadmin/superadmin, qb-core / qbx_core permissionsadmin/god; - np_discord runs and they hold a role of
Config.AdminDiscordRoles.
np_fuel replaces np_admin's default fallback with this rule, so the np_admin_fallback convars are not read.
Items ​
| Item | What for | Metadata |
|---|---|---|
jerrycan |
A can of fuel. Use it next to a vehicle to pour, at a pump to fill. See Jerry can | { fuel = litres, fuelType, capacity, contaminated? }. A can without fuel (e.g. from a shop) counts as full of petrol |
fuel_receipt |
The receipt of a fill-up or a charge | { station, stationName, brand, fuel, litres, cents, price, plate, method, ref, at, pump, via } |
np_inventory registers both at runtime, the jerry can with server = { export = 'np_fuel.jerrycan' }.
np_inventory's built-in jerry can steps aside while np_fuel runs (Config.BuiltinItems.jerrycan.owner = 'np_fuel',
the default in np_inventory builds with np_fuel support). On an older np_inventory set
Config.BuiltinItems.jerrycan.enabled = false there. See np_inventory → Built-in items.
ox_inventory (ox_inventory/data/items.lua; on qbx_core too):
['jerrycan'] = {
label = 'Jerry can', weight = 5000, stack = false, close = true, consume = 0,
description = 'A can for fuel. Fill it at a pump, pour it into any vehicle.',
server = { export = 'np_fuel.jerrycan' },
},
['fuel_receipt'] = {
label = 'Fuel receipt', weight = 1, stack = false, close = true,
description = 'Litres, price, pump, time and plate of a fill-up.',
},
qb-core (qb-core/shared/items.lua):
jerrycan = { name = 'jerrycan', label = 'Jerry can', weight = 5000, type = 'item', image = 'jerrycan.png',
unique = true, useable = true, shouldClose = true,
description = 'A can for fuel. Fill it at a pump, pour it into any vehicle.' },
fuel_receipt = { name = 'fuel_receipt', label = 'Fuel receipt', weight = 1, type = 'item', image = 'fuel_receipt.png',
unique = true, useable = false, shouldClose = true,
description = 'Litres, price, pump, time and plate of a fill-up.' },
qb-inventory has no metadata setter, so np_fuel replaces the can in its slot when its litres change. The membership
discount (Config.Pump.membership, off by default) reads an item of your choice (fuel_card); np_fuel registers none.
Tables ​
| Table | Holds |
|---|---|
fuel_meta |
Schema version and small persistent facts (removed stations, depot overrides, owed refunds) |
fuel_vehicles |
Fuel level, fuel type and contamination per plate |
fuel_stations |
Stations: kind, brand, name, coordinates, owner, prices, company balance, meta, sale listing |
fuel_station_stock |
Litres, capacity and contaminated litres per station and fuel |
fuel_ledger |
Every sale, delivery, deposit, withdrawal, wage and stock change, in cents |
fuel_timers |
Timers and cooldowns that survive restarts |
fuel_station_staff |
Staff per station: role, permissions, wage |
fuel_orders |
Delivery orders |
fuel_drivers |
Driver reputation (XP, level, deliveries, litres), owed cents and the active run |
fuel_alarms |
Price alarms of the Fuel app |
fuel_favourites |
Favourite stations of the Fuel app |
Config.Ledger.keepDays (90) drops old ledger rows; Config.Vehicles.keepDays (30) drops levels of vehicles nobody
owns.
Check it works ​
- The console prints
np_fuelready with the framework, the inventory and one line per sibling. - Drive to a station, press E at a pump: the pump screen opens with prices and stock.
- As staff, run
/setfuel 10in a vehicle, then/fuelinfoat a station, then/fueladminfor the network overview.
Before you open it ​
What the test harness cannot check. Walk through these once on your server:
- Stations: drive to every station with
verified = false(shared/config/02_stations.lua) and check its brand and radius; fix it in the editor (/fueladmin editor, the change lands in the database). Place every fill point (where the tanker hoses in) and the office (owner panel and buy prompt). - Pumps: press E at the pumps of a few stations. If a pump model is missing from
Config.PumpModels, add it. Try the nozzle mode once (Config.Pump.mode = 'nozzle'): the hose, the fuel cap, ripping it. - Depots: place both depots and their rig spawn in the editor (Depots → Move here / Rig spawn) on open road. Rent a rig, load, drive to a station, unload.
- EV: charge at a Coil site. Replace
Config.EV.chargerModelif the prop looks wrong, and place chargers where you want them. - Money: buy a station with a test character, set a price, order a delivery, let another character deliver it, withdraw. With np_payments, check the sheet shows the station as merchant.
- Inventory: the jerry can (fill at a pump, pour) and a receipt after a fill-up.
- np_hud: the fuel tile follows the level while driving and shows the battery in an EV.
- Staff: one account with the np_admin nodes (or in
Config.Admins): open/fueladmin, run/setfuel 10.
Troubleshooting ​
| Problem | Fix |
|---|---|
| Blank screens, nothing visible | Build the NUI (web/dist missing) |
| No prompt at a pump | The pump model is not in Config.PumpModels (MLO pumps), or you stand outside the station radius. Check the station in the editor |
| Fuel is free, nothing is charged | No framework is running: standalone has no economy (Config.Pay.standaloneFree) |
| No receipt, no jerry can | No inventory, or the items are missing from ox_inventory / qb-core (see Items) |
| np_inventory's jerry can pours through its own logic | np_inventory without np_fuel support: set Config.BuiltinItems.jerrycan.enabled = false there |
| A vehicle shop's car spawns empty or full regardless of its script | Raising fuel from a client script is only allowed right after spawn for an unknown plate (Config.Vehicles.restoreSeconds), see Bridges → Other fuel resources |
/fueladmin says no permission |
Grant the node in np_admin, or (without np_admin) add your identifier to Config.Admins |
| Nobody can take a tanker order | np_identification runs and the player has no driver_license with class C or CE (kerosene: also hazmat_license and driver level 4). See Supply → Licences |
| The rig spawns inside a building | The depots and rig spawns are placeholders: place them in the editor (Depots) |