Skip to content

The jerry can

The jerry can

A carried can you fill at a pump and pour into a car. It is a plain inventory item, not a weapon.

The vanilla weapon_petrolcan is deliberately not used. That model carries the flamethrower behaviour — players can trail fuel across the ground and light it. The item here can do exactly one thing: fill a vehicle's tank.

How it behaves in game

  • Use the item. The can appears in your hand and tells you how many litres are in it.
  • Walk to a vehicle and target its fuel cap, or stand near it and press [E].
  • It pours at Config.JerryCan.PourRate litres per tick, and the fuel that goes in obeys the wrong fuel rules like any other fill.
  • Walk more than Config.JerryCan.MaxDistance away and the can goes back in your pocket.
  • At a pump, [G] refills the can. If you do not have one, a station can sell you a full can outright for Config.JerryCan.FullPrice.

Each can carries its own fuel level, which is why every inventory entry below marks it unique / non-stackable. Stacking two cans would merge two different amounts into one slot.

config.lua
Config.JerryCan = {
    Enabled  = true,
    Item     = 'jerrycan',
    Prop     = 'prop_jerrycan_01a',
    Capacity = 20,
    SellFull  = true,
    FullPrice = 60,
}

If you already run a fuel can under another name, change Config.JerryCan.Item instead of renaming your item.

What ships in install/

Path Contents
install/README.txt The short version of everything on this page
install/img/jerrycan.png The icon, ready to drop into your inventory
install/inv/ox_inventory.txt ox_inventory
install/inv/qb_inventory.txt qb-inventory, lj-inventory, ps-inventory
install/inv/qs_codem_tgiann.txt qs-inventory, codem-inventory, tgiann-inventory
install/inv/esx.txt classic ESX inventories

ox_inventory

Copy the image into ox_inventory/web/images/, then add the item.

ox_inventory/data/items.lua
['jerrycan'] = {
    label = 'Jerry Can',
    weight = 4000,
    stack = false,
    close = true,
    description = 'Holds 20 litres of fuel. Use it, then pour it into a car.',
    client = {
        export = 'bupa-fuel.useJerryCan'
    }
},

ox_inventory has no CreateUseableItem, so the client.export line is how the resource learns the can was used. stack = false is required.

qb-inventory, lj-inventory, ps-inventory

Copy the image into qb-inventory/html/images/ — lj and ps read the same folder — then add the item to qb-core/shared/items.lua.

qb-core/shared/items.lua
['jerrycan'] = {
    ['name'] = 'jerrycan',
    ['label'] = 'Jerry Can',
    ['weight'] = 4000,
    ['type'] = 'item',
    ['image'] = 'jerrycan.png',
    ['unique'] = true,
    ['useable'] = true,
    ['shouldClose'] = true,
    ['combinable'] = nil,
    ['description'] = 'Holds 20 litres of fuel. Use it, then pour it into a car.'
},

The resource registers the use handler itself through CreateUseableItem, so nothing goes in qb-core/server/main.lua.

qs-inventory, codem-inventory, tgiann-inventory

All three read the same item definition as qb-core above. Only the image folder differs:

Inventory Image folder
qs-inventory qs-inventory/html/images/
codem-inventory codem-inventory/html/itemimages/
tgiann-inventory tgiann-inventory/html/images/

tgiann users who keep a separate list add the item to tgiann-inventory/shared/items.lua instead.

ESX

Copy the image into your inventory's image folder — esx_inventoryhud/html/img/items/ for the classic HUD, or ox_inventory/web/images/ for ESX setups running on ox — then insert the item.

SQL
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`)
VALUES ('jerrycan', 'Jerry Can', 4, 0, 1);

Older ESX schemas without those columns take the short form:

SQL
INSERT INTO `items` (`name`, `label`) VALUES ('jerrycan', 'Jerry Can');

The resource calls ESX.RegisterUsableItem itself, so no usable-item registration goes anywhere else.

Testing

code
/giveitem <id> jerrycan 1

Then restart your inventory and bupa-fuel.

The EV battery

Electric charging has its own item, ev_battery, defined the same way as the can — a normal item with no use handler needed, since it is sold and consumed by the charger. See Electric charging.