Events ​
Server events ​
server
Local server events (AddEventHandler), never sent over the network. Use them for logs (Discord, MDT), statistics or
follow-up actions. Amounts are in cents, litres in litres (kWh for electric).
| Event | Payload | Fired when |
|---|---|---|
np_fuel:server:ready |
none | np_fuel finished starting; exports answer from now on |
np_fuel:server:refueled |
{ source, netId, plate, fuel, amount, percent, cents, station, method, via } |
A vehicle got fuel. amount = litres or kWh, percent = the new level, via = 'pump', 'nozzle', 'jerrycan', 'ev', 'admin' or 'script'. method = 'inside': pay inside, nothing is paid yet (the bill waits at the shop counter) |
np_fuel:server:stockChanged |
{ station, fuel, litres, previous, reason } |
A station's stock changed (sale, delivery, staff, AddStock) |
np_fuel:server:pricesChanged |
{ station, prices = { <fuel> = cents }, by } |
An owner, staff or the brand drift changed prices |
np_fuel:server:stationOwnerChanged |
{ station, from, to, reason } |
A station was bought (reason = 'purchase', also an accepted offer) or staff set the owner or gave it back to the brand ('admin'). from / to are character identifiers, nil = the brand |
np_fuel:server:deliveryCompleted |
{ source, station, fuel, litres, cents, order, contaminated } |
A driver unloaded into a station's tank (once per unload). contaminated = litres of wrong fuel |
lua
AddEventHandler('np_fuel:server:refueled', function(e)
if e.via == 'pump' and e.cents >= 10000 then
print(('%s paid $%.2f for %.1f l %s at %s'):format(e.plate, e.cents / 100, e.amount, e.fuel, e.station))
end
end)
AddEventHandler('np_fuel:server:deliveryCompleted', function(e)
if e.contaminated and e.contaminated > 0 then
print(('wrong fuel delivered to %s (%.0f l)'):format(e.station, e.contaminated))
end
end)
AddEventHandler('np_fuel:server:refueled', function(e)
if e.method == 'inside' then
-- pay inside: the fuel is in, the bill waits at the shop counter
end
end)
AddEventHandler('np_fuel:server:stationOwnerChanged', function(e)
-- e.reason: 'purchase' (bought, also an accepted offer) or 'admin' (staff in the editor)
end)
Events np_fuel listens to ​
| Event | From | Effect |
|---|---|---|
np_phone:appState |
np_phone (client) | The Fuel app opened or closed: live price updates start or stop |
onResourceStart |
FiveM | np_phone restarted: the app is registered again |
np_prophandler:ready |
np_prophandler (server, client) | np_prophandler restarted: the server registers the charger props again, the client their charge predicate |
np_fuel:client:evCharge |
np_prophandler (client) | The charger's E option: opens the charge screen |
playerDropped |
FiveM | A running fill, charge or unload settles at once; an unpaid refund waits for the next login; an open pay inside bill becomes a drive-off |
np_shops:server:ready |
np_shops (server) | Every linked shop pair is worked out and reconciled again |
Net events (np_fuel:rpc, np_fuel:rpcResult, np_fuel:init, np_fuel:station(s), np_fuel:sync, np_fuel:nui,
np_fuel:notify, np_fuel:waypoint and the module events np_fuel:<module>:*) are internal. See the
NUI contract.
Commands and keys ​
| Command / key | What |
|---|---|
| E at a pump (or the target option) | The pump screen; at a Coil charger the charge screen; in nozzle mode: take or hang up the nozzle, E at the fuel cap to choose and pay, hold E to pump |
| G (rebindable) | Route to the station the low-fuel hint suggested |
| H (rebindable) | Fill the jerry can at the pump you stand at |
F7 (rebindable) / /fuelorders |
The order board |
| E (hold) at the depot / fill point | Load / unload a chamber; ← → chamber, ↑ ↓ fuel |
/station |
The owner panel of the station you stand in (or your first one); buying at a station's office |
/setfuel, /fueladmin, /fuelinfo |
Staff, see Staff tools |