Exports and events

Refueling Nozzles V2 exposes exports and events so your own scripts can read and change fuel. The client exports take the vehicle entity.

Read and set the fuel level

local level = exports.refuelingnozzlesv2:GetFuel(vehicle) -- 0 - 100
exports.refuelingnozzlesv2:SetFuel(vehicle, 50.0)          -- 0 - 100

SetFuel ignores values outside 0 – 100. It keeps the tank's blend; on an empty tank it fills with the vehicle's own fuel, so a repair or refuel from another script never adds the wrong fuel.

Both also answer as exports['LegacyFuel']:GetFuel / SetFuel — see LegacyFuel compatibility below.

What's in the tank

local fuel = exports.refuelingnozzlesv2:GetFuelType(vehicle)         -- "95", "98", "diesel", "electric"
local mix = exports.refuelingnozzlesv2:GetFuelMix(vehicle)           -- { ["95"] = 0.7, diesel = 0.3 }
local capacity = exports.refuelingnozzlesv2:GetTankCapacity(vehicle) -- litres (kWh for electric)
  • GetFuelType(vehicle) — the fuel the tank mostly holds. nil for an empty tank
  • GetFuelMix(vehicle) — every fuel in the tank as shares that add up to 1. Empty for electric vehicles and empty tanks
  • GetTankCapacity(vehicle) — the tank size in litres, or the battery size in kWh

Put a blend back:

exports.refuelingnozzlesv2:SetFuelMix(vehicle, { ["95"] = 0.7, diesel = 0.3 }, 80.0)

SetFuelMix(vehicle, mix, level) — mix takes shares or percents (they are normalised), level (0 – 100) is optional. It does nothing on an electric vehicle — use SetFuel there.

Engine state

local kind = exports.refuelingnozzlesv2:GetEngineFuelKind(vehicle)  -- "petrol", "diesel", "electric"
local wrong = exports.refuelingnozzlesv2:GetWrongFuelShare(vehicle) -- 0 - 1
local state, share = exports.refuelingnozzlesv2:GetEngineFuelState(vehicle)
  • GetEngineFuelKind(vehicle) — what the engine runs on
  • GetWrongFuelShare(vehicle) — the share of the tank that is the wrong fuel for this engine
  • GetEngineFuelState(vehicle) — the state, plus the wrong fuel share as a second value

The states:

  • "ok" — clean
  • "mixed" — some wrong fuel, but it runs fine
  • "stutter" — misfires and loses power (from WrongFuel.StutterFrom)
  • "dead" — will not run until the tank is siphoned (from WrongFuel.StallFrom)
local state = exports.refuelingnozzlesv2:GetEngineFuelState(vehicle)
if state == "dead" then
    ShowEngineIcon("red")
elseif state == "stutter" then
    ShowEngineIcon("orange")
end

With WrongFuel.Enabled = false it never returns "stutter" or "dead".

Jerry can

Client side, for the can the player carries:

local can = exports.refuelingnozzlesv2:GetJerryCan()
-- nil without a can, else:
-- can.Liters, can.Capacity, can.Percent
-- can.Fuel         = the main fuel id, e.g. "98"
-- can.Mix          = { ["95"] = 0.22, ["98"] = 0.78 }
-- can.Kind         = "petrol" / "diesel" (nil when empty)
-- can.Contaminated = true when petrol and diesel are mixed

exports.refuelingnozzlesv2:SetJerryCan(15.0, { diesel = 1.0 })

SetJerryCan(liters, mix) sets the litres (up to Capacity) and the mix (any scale, normalised; without one the can holds JerryCan.FillFuel). It returns true, or false when the player has no can.

Saving it in an inventory item:

--Save what's in the can into the item's metadata
local can = exports.refuelingnozzlesv2:GetJerryCan()
if can then metadata.fuel = { liters = can.Liters, mix = can.Mix } end

--Put it back once the can is equipped again
exports.refuelingnozzlesv2:SetJerryCan(metadata.fuel.liters, metadata.fuel.mix)

Server exports

local prices = exports.refuelingnozzlesv2:GetFuelPrices()
-- today's prices: { Day = "2026-11-22", ["95"] = 1.71, ["98"] = 1.88, diesel = 1.80, electric = 0.44 }

local stock = exports.refuelingnozzlesv2:GetStationStock(index)
-- { Liters = 12000, Capacity = 30000 }, or nil

local moved = exports.refuelingnozzlesv2:AddStationStock(index, 5000)
-- the litres actually moved; a negative amount takes fuel out

index is the station's position in Config.GasStations. GetStationStock returns nil while StationStock is off.

Events (client)

--A nozzle or EV plug was taken out of a vehicle. liters = what is in its tank now
AddEventHandler('RefuelingNozzlesV2:VehicleRefueled', function(vehicle, liters, capacity)
end)

--The tanker job spawned your rig: hand out keys from your own keys / garage script
AddEventHandler('RefuelingNozzlesV2:TankerTruckSpawned', function(truck, trailer)
end)

--A custom font for the 3D prompts
TriggerEvent('RefuelingNozzlesV2:SetFont', fontId)

On QBCore the tanker's keys are already handed out through vehiclekeys:client:SetOwner.

Your own prompts

Set Config.Settings.DisplayStyle = "EVENT" and the script draws no prompts; it sends them to you instead. From your own resource:

AddEventHandler('RefuelingNozzlesV2:DisplayMessage', function(text)
    --text still holds the key hint and GTA colours, e.g. "[~g~E~w~] Use Pump"
    lib.showTextUI((text:gsub("~%a~", "")))
end)

AddEventHandler('RefuelingNozzlesV2:HideMessage', function()
    lib.hideTextUI()
end)

A message is sent once each time it changes, not every frame. A prompt with two actions comes as two lines.

LegacyFuel compatibility

The script declares provide 'LegacyFuel', so:

  • exports['LegacyFuel']:GetFuel and SetFuel resolve to Refueling Nozzles V2
  • the _FUEL_LEVEL decor is kept up to date, like LegacyFuel
  • the game's own fuel level (GetVehicleFuelLevel) matches the tank
  • consumption uses LegacyFuel's Classes / FuelUsage tables
After restarting refuelingnozzlesv2 on a running server, also restart the scripts that call exports['LegacyFuel'] — they keep the old link until they restart. A full server restart avoids it.
Get the scriptGet Refueling NozzlesFiveM Fuel Script →
Can't find what you need? Ask on Discord — response in under 5 hours.