Skip to content

Items ​

Items are defined in shared/config/items.lua (everything except weapons) and shared/config/weapons.lua (weapons, ammo, attachments). Both fill Config.Items[name]. You can add files of your own to shared/config/ the same way; they load in alphabetical order. Weights are grams per unit.

lua
Config.Items.water = {
  label = 'Water', description = 'Still water, 0.5 l.',
  weight = 500,
  category = 'drink',            -- tint and default icon
  icon = 'bottle-water',         -- Font Awesome 6 solid glyph
  consume = { thirst = 25 },     -- after the progress; removes 1
  use = {
    duration = 2500, label = 'Drinking…', cancel = true,
    anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle', flag = 49 },
    prop = {
      model = 'prop_ld_flow_bottle', bone = 18905,
      pos = { 0.12, 0.008, 0.03 }, rot = { 240.0, -60.0, 0.0 },
    },
    disable = { move = false, car = false, combat = true },
  },
}

Item names may contain letters, digits, _ and -. Lookups also try the lowercase name, so WEAPON_PISTOL finds weapon_pistol. Add items at runtime with exports.np_inventory:RegisterItem(name, def) on the server (Exports); the definition is sent to every client, also to players who join later.

Fields ​

Field Default Description
label the name Display name (max 64 characters). Localised by the item_<name> locale key when it exists
description Tooltip text (max 512). Localised by itemdesc_<name>
weight 0 Grams per unit
stack true false = unique: count is always 1 and every instance has its own metadata. Weapons (except throwables), bags, durability items and equippable items are always unique
maxStack Cap per slot for stackable items
close true Close the inventory when the item is used
category 'misc' See Categories. Decides the tile tint and the default icon
icon from the category Font Awesome 6 solid glyph name ('bottle-water')
tint from the category Override the category tint
image Optional image file instead of the glyph, see Images
useable computed true when any of consume, use, server, client, weapon, ammo, component, document, container, equip or an enabled builtin is set (a use block of a switched-off built-in doesn't count). Set false to hide "Use" anyway
consume { hunger, thirst, stress, health, armor } deltas, applied after the progress. Removes 1 unit
use Progress, animation and prop, see Use
durability true: tracks metadata.durability 0–100, starting at 100
degrade Durability lost per use (lockpick: 20)
keepBroken With durability: keep the item at 0 % instead of removing it
decay Seconds from fresh to spoiled (food), see Durability & decay
weapon Weapon item, see Weapons
ammo true for ammo items
component Attachment, see Attachments
clipBonus Extra rounds per weapon for magazine attachments
container Bag, see Containers
equip Equippable item, see Equipment
document true: an ID card or licence, see Documents
actions Extra context menu entries, see Custom actions
builtin Built-in behaviour: 'repairkit', 'spare_tire', 'jerrycan', 'lockpick', 'adrenaline', 'radio' or 'phone', see Built-in items
server { export = 'resource.fn' }, ox style: called with usingItem, usedItem and buying, see below
client { event = 'name' } and / or { export = 'resource.fn' } fired on the client after a use

Categories ​

The tile colour means something, the same way as in np_hud. Config.Categories[id] = { label, icon, tint }; labels are localised with the cat_<id> keys.

Category Tint Default icon
medical red kit-medical
food orange burger
drink aqua bottle-water
weapon rust gun
ammo rust circle-dot
money green money-bill-wave
document blue id-card
illegal lilac cannabis
bag olive suitcase
clothing olive shirt
tool neutral screwdriver-wrench
electronic neutral microchip
material neutral cubes
key neutral key
misc neutral box

Tints: neutral, red, orange, rust, pink, olive, lilac, green, blue, aqua. The category also filters the inventory (the category buttons above the grid), sorts (sort by category) and decides what police see in a pat-down (Config.Police.friskCategories: weapon, ammo, illegal).

Icons and images ​

By default every item is a glossy tile with a white Font Awesome glyph (icon). For a picture instead, set image:

lua
Config.Items.goldbar = { label = 'Gold Bar', weight = 1000, category = 'misc', image = 'goldbar.png' }

The file is loaded from Config.ImagePath .. image. The default path is nui://np_inventory/web/images/: put PNG or WebP files into web/images/ (the manifest ships web/images/*.png and *.webp). Point Config.ImagePath at a URL to use images hosted elsewhere, for example another resource's folder (nui://ox_inventory/web/images/ if you kept those files). A single instance can override the image with metadata.image.

Use ​

When a player uses an item (double-click, E, the context menu, a hotbar key or the useSlot export), the server checks it and dispatches by kind:

Item What happens
weapon Draws or holsters the weapon
component Attaches to the drawn weapon
enabled builtin The built-in behaviour, with the timed use below
ammo Reloads the drawn weapon
container Opens the bag panel
document (without consume / use) Shows the card
equip (without consume / use / client / server) Equips or unequips
No own use, but a framework usable item Calls the framework callback, see below
Everything else The timed use below

The timed use: the server issues a one-time token and sends the use to the client. The client plays the progress bar (np_hud's or np_inventory's), the animation and the prop (a local np_prophandler attachment), then reports back. The server checks the token, that at least duration × Config.Use.minElapsed has passed, and that the item is still there and unchanged. Only then it applies consume, removes one unit or applies degrade, calls server.export with usedItem and fires the client hooks. server.export is asked with usingItem before the token is issued, so it can refuse the use up front.

lua
use = {
  duration = 3000,                      -- ms; 0 or missing = instant
  label = 'Applying bandage…',          -- default "Using <item>…"
  cancel = true,                        -- the player can cancel (X without np_hud)
  anim = { dict = '…', clip = '…', flag = 49 },
  prop = { model = 'prop_ld_flow_bottle', bone = 18905, pos = { x, y, z }, rot = { x, y, z } },   -- or a list of props
  scenario = nil,                       -- e.g. 'WORLD_HUMAN_CLIPBOARD' instead of anim
  disable = { move = false, car = false, combat = true },   -- controls blocked during the progress
}
  • disable.car = true also refuses the use while the player sits in a vehicle (Config.Use.blockInVehicle does that for every item).
  • Uses are refused while the player is dead or cuffed, for broken items (durability 0) and for spoiled food.
  • consume deltas: hunger, thirst and stress go to the framework (qb / qbx metadata, esx_status on ESX, the local np_inventory:status event standalone). health and armor are applied to the ped on the client. Stress is usually negative.

Your own logic: server and client ​

The callbacks follow ox_inventory, so item definitions written for ox keep their callbacks:

lua
Config.Items.scratchcard = {
  label = 'Scratch Card', weight = 5, category = 'misc',
  consume = {},                                     -- remove one per use
  use = { duration = 2000, label = 'Scratching…' },
  server = { export = 'my_lottery.scratch' },
  client = { event = 'my_lottery:scratched' },      -- TriggerEvent(event, item) on the client
}
lua
-- my_lottery/server.lua
exports('scratch', function(event, item, inventory, slot, data)
  if event == 'usingItem' then
    -- before the use: return false to refuse it
    return exports.np_inventory:CanCarryItem(inventory.id, 'money', 500)
  elseif event == 'usedItem' then
    exports.np_inventory:AddItem(inventory.id, 'money', math.random(0, 500))
  elseif event == 'buying' then
    -- before a shop purchase: data = { id, label, index, name, price, currency, count }; false refuses it
  end
end)
Hook Called Arguments Notes
server.export = 'resource.fn' Server: usingItem before the use, usedItem after it, buying before a shop purchase (event, item, inventory, slot, data) item is a copy of the definition, inventory a plain copy (for a player, inventory.id is the server id). false from usingItem cancels the use, from buying the purchase. An export that errors counts as false
client.event = 'name' Client, after the server confirmed (item) A local event (AddEventHandler) with the slot item
client.export = 'resource.fn' Client, after the server confirmed (data, slot) data = item definition, slot = { name, slot, metadata, count, label }

Inside a client.export, exports.np_inventory:useItem(data, cb) (ox's useItem) calls cb(slot) right away: the progress and the server confirmation already happened before the export runs.

An item with only server or client (no consume) isn't removed by the use; give it consume = {} or remove it yourself. degrade is applied on every completed use.

Framework usable items ​

Items without their own use (no consume, use, server, client, no enabled builtin, and not a weapon, ammo, attachment, bag, document or equippable) are handed to the framework's usable item callback when one is registered: QBCore.Functions.CreateUseableItem (qb), exports.qbx_core:CreateUseableItem (qbx) or ESX.RegisterUsableItem (esx). The callback gets (source, item) with the item in qb's shape (name, amount, info, slot, …). So scripts that register usable items keep working: just define the item in Config.Items without a use.

The list of such items is published in GlobalState.np_inventory_usable (refreshed when a resource starts), so the UI offers "Use" for them.

Built-in items ​

Seven items work out of the box. They have builtin = '<name>' in items.lua, and each is configured (or switched off) in Config.BuiltinItems (Configuration). The client picks the target before the progress bar; without one the use is cancelled with "no target" and nothing is used up. The server checks the target again before anything is consumed or worn down.

Item Target and effect Used up
repairkit The closest vehicle within 3 m whose engine is below 60 %. The player must stand at the hood (the rear of mid-engine cars), which opens. The engine is set to engine % (60) degrade 34: three repairs
spare_tire The closest vehicle with a burst tyre; fixes the burst wheel nearest to the player One per use
jerrycan The closest vehicle below 99 % fuel. Pours what fits into the tank, up to what's left in the can (metadata.fuel, litres; a new can holds capacity, 20). Fuel goes through the first started of np_fuel, ox_fuel, LegacyFuel, cdn-fuel, ps-fuel, else SetVehicleFuelLevel. An empty can says "empty". Steps aside while np_fuel runs (see below) Only the fuel; the empty can stays
lockpick The closest locked vehicle. The server rolls chance % (35) (with np_minigames: its lockpick game); on success it unlocks the doors. Every attempt is logged (lockpick) degrade 20 per attempt, only when there was a locked vehicle; removed at 0
adrenaline The closest downed player within 2 m. Revived through the framework (hospital:client:Revive on qb / qbx, esx_ambulancejob:revive on ESX), standalone by np_inventory itself (healed by heal). Set revive = function(src, target) for your own ambulance script. Logged (revive) One per use
radio Opens the first started radio resource in resources (qb-radio: qb-radio:use); otherwise, with pma-voice, asks for a channel (0 = off); otherwise fires the local event np_inventory:radio (item) Nothing
phone exports.np_phone:toggle(); without np_phone the local event np_inventory:phone (item) Nothing

With enabled = false an item loses its built-in use and goes to the framework's usable callback when there is one (e.g. qb-radio registers radio). Add builtin = 'jerrycan' to your own items to give them the same behaviour.

Minigames (np_minigames) ​

Lockpick in np_minigames

While np_minigames runs and Config.Minigames.enabled is on (the default), the built-ins below play a server-validated np_minigames game instead of their timed progress bar (and, for the lockpick, instead of the chance roll). Without np_minigames, or with a switch off, nothing changes.

Item Game (default) Outcome
lockpick lockpick, difficulty by vehicle class A win unlocks the car. A failure with a reason in breakOn (broken: the pick snapped) breaks the pick (removed; durability 0 with keepBroken). Every real attempt still wears it by the item's degrade (20)
repairkit torque, easy, off A lost game means no repair; the kit still wears
spare_tire torque, easy, 4 checks, off A lost game means no new tyre

np_inventory keeps owning the item: wear per attempt, breaking and consumption. Nothing is passed as np_minigames' opts.item. The lockpick's difficulty comes from the vehicle class (a client hint, like the trunk sizes); models overrides it per model on the server:

lua
Config.Minigames = {
  enabled = true,
  wait = 180000,                 -- ms the client waits for the server's answer while a game runs
  lockpick = {
    enabled = true, game = 'lockpick', difficulty = 'medium',
    classes = {                  -- vehicle class -> difficulty; missing classes use `difficulty`
      [0] = 'easy', [1] = 'easy', [8] = 'easy', [13] = 'easy',                    -- compacts, sedans, motorcycles, cycles
      [2] = 'medium', [3] = 'medium', [4] = 'medium', [5] = 'medium', [9] = 'medium', [12] = 'medium',
      [6] = 'hard', [22] = 'hard',                                                -- sports, open wheel
      [7] = 'expert', [18] = 'expert', [19] = 'expert',                           -- super, emergency, military
    },
    models = {},                 -- model name -> difficulty, checked on the server, e.g. { police = 'expert' }
    breakOn = { 'broken' },      -- failure reasons that break the pick
    opts = { maxMove = 2.0 },
  },
  repairkit = { enabled = false, game = 'torque', difficulty = 'easy', opts = { maxMove = 2.0 } },
  spare_tire = { enabled = false, game = 'torque', difficulty = 'easy', opts = { checks = 4, maxMove = 2.0 } },
}

The repair kit and spare tire games are off by default because a lost game changes the balance. np_inventory is also np_minigames' first-choice item bridge for other resources' opts.item: it uses GetItemCount, RemoveItem and DegradeItem.

Owner resource: np_fuel takes the jerry can ​

Config.BuiltinItems.jerrycan.owner = 'np_fuel' (the default). While np_fuel is started, the built-in jerry can steps aside: the server sends no built-in data and validates no target, and the can goes, in this order, to

  1. the item's own server / client export, when the owner registered the item again with exports.np_inventory:RegisterItem('jerrycan', def) (np_fuel does: server = { export = 'np_fuel.jerrycan' });
  2. else the framework usable callback the owner registered (ESX.RegisterUsableItem('jerrycan', cb), qb / qbx CreateUseableItem), which gets the can with its metadata.fuel litres;
  3. else not_useable (nothing is played or used up).

It is checked on every use, so starting or stopping np_fuel switches over without a restart. New cans get metadata.fuel = capacity in both modes, so cans are interchangeable; np_fuel adds its own keys (fuelType). owner = false keeps the built-in always. Every built-in entry can take an owner the same way.

Durability and decay ​

Both show as a bar under the tile and in the tooltip (Condition / Freshness, 0–100 %).

  • Durability (durability = true): starts at 100. degrade subtracts per use, weapons lose weapon.wear per shot, an equipped vest follows the armour the ped lost. At 0 the item is removed, or kept broken with keepBroken = true (broken items can't be used).
  • Decay (decay = seconds): a new instance gets metadata.created and metadata.expires = created + decay. Freshness is computed when it's read, so nothing ticks. created is rounded down to Config.Decay.stackWindow seconds, so food bought within the same minute stacks. Spoiled food (0 %) can't be eaten unless Config.Decay.eatSpoiled (then it adds spoiledStress).
  • Coolers: a container with decayRate (the cooler has 0.25) stretches the remaining time while food is inside it (four times longer) and reverses that when it's taken out.

Set a value from a script with SetDurability(inv, slot, percent); for decay items it sets the freshness.

Weapons ​

lua
Config.Items.weapon_pistol = {
  label = 'Pistol', weight = 1000, category = 'weapon', icon = 'gun',
  weapon = { hash = 'WEAPON_PISTOL', ammo = 'ammo_9', clip = 12, wear = 0.05 },
  actions = { { id = 'unload', label = 'Unload', icon = 'eject' } },
}
Config.Items.ammo_9 = { label = '9mm Ammo', weight = 12, category = 'ammo', icon = 'circle-dot', ammo = true }
weapon field Description
hash GTA weapon name. Default: the item name in upper case
ammo Ammo item used for reloads
clip Rounds per magazine
wear Durability lost per shot (default 0.05)
melee Melee weapon: no ammo, goes into the secondary equipment slot
throwable Grenades and the like: stackable, not equippable, each throw uses one
  • Every weapon instance gets metadata.serial (Config.Weapons.serialPrefix) and metadata.registered (the receiving character's name) when it's created. metadata.ammo holds the rounds in the magazine.
  • Draw / holster: use the weapon from the hotbar or the inventory. The GTA weapon wheel is disabled (Config.Weapons.disableWheel).
  • Reload: R, or use an ammo item. Ammo moves from the ammo items into metadata.ammo up to the clip size.
  • Unload: the unload action puts the rounds back as ammo items.
  • Wear and jams: with Config.Weapons.durability each shot costs wear. Below Config.Weapons.jamBelow (15 %) shots can jam; R clears the jam. At 0 % the weapon can't be used.
  • The client reports ammo and shots to the server; ammo can only go down and the shot count is capped per sync.

Attachments ​

lua
Config.Items.at_clip_extended = {
  label = 'Extended Magazine', weight = 200, category = 'weapon', icon = 'layer-group',
  component = {
    WEAPON_PISTOL = 'COMPONENT_PISTOL_CLIP_02',
    WEAPON_CARBINERIFLE = 'COMPONENT_CARBINERIFLE_CLIP_02',
  },
  clipBonus = { WEAPON_PISTOL = 4, WEAPON_CARBINERIFLE = 30 },
}

Using an attachment attaches it to the drawn weapon when that weapon is in component. The weapon's metadata.components lists the attachment item names. The detach action (on the weapon) gives an attachment back. clipBonus raises the clip size while the attachment is on.

Containers (bags) ​

lua
Config.Items.backpack = {
  label = 'Hiking Backpack', weight = 1200, category = 'bag', icon = 'suitcase', close = false,
  container = { slots = 16, maxWeight = 10000, blacklist = { 'backpack', 'duffel_bag', 'cooler' } },
  equip = { slot = 'bag', bonus = { weight = 20000 } },
}
container field Default Description
slots 10 Slots in the bag (1–100)
maxWeight 10000 Grams the bag holds
whitelist Only these items fit (the cooler: food and drinks)
blacklist These items don't fit
decayRate Decay speed inside the bag, e.g. 0.25 (see decay)
  • A bag gets its own inventory (container:<uid>) the first time it's opened; the uid stays in metadata.container, so the contents travel with the bag through drops, trunks, gives and trades.
  • One level deep: no bag inside a bag. A bag opens only while it's in the pockets or the equipment bag slot.
  • The bag's weight includes its contents. An equipped bag's contents don't count towards the player's weight.

Equipment ​

lua
Config.Items.armour_vest = {
  label = 'Armour Vest', weight = 3000, category = 'clothing', icon = 'shield-halved', durability = true,
  equip = { slot = 'vest', bonus = { armor = 100 } },
}
equip field Description
slot head, mask, glasses, vest, bag, primary, secondary or hands
bonus.weight Extra carry weight in grams while equipped
bonus.slots Extra pocket slots while equipped. The item can only be unequipped while those slots are empty
bonus.armor Armour while equipped. The vest's durability follows the armour the ped loses
component / prop { id, drawable, texture } clothing to show on the ped

Weapons go into primary (melee into secondary) without an equip table. Using an equippable item equips it; using it in the equipment panel puts it back into the pockets.

equip.component and equip.prop are applied to the local ped when the item is equipped. The inventory captures the ped's current component / prop the first time it changes and restores that appearance when the item is unequipped. Use drawable and texture IDs that exist for the player's ped model; invalid variations are skipped.

Documents ​

lua
Config.Items.id_card = {
  label = 'ID Card', weight = 10, stack = false, category = 'document', icon = 'id-card', document = true, close = false,
}
  • When a document is created in a player's inventory without a name in its metadata, np_inventory fills it from the character: name, birthdate, nationality, sex, issued (today) and idnumber (LSD-1234-5678 for id_card, DL-… for driver_license, WL-… for weapon_license, DOC-… for others).
  • Using it (or the show action) shows the card to the nearest player within Config.Give.distance, and to the holder. The card closes after 8 s or with ESC.
  • Licence checks in shops read the framework's licences (qb / qbx metadata, esx_license), not the item. Standalone is the exception: a <name>_license item counts as licence <name>.

Custom actions ​

lua
Config.Items.phone = {
  label = 'Phone', weight = 190, stack = false, category = 'electronic', icon = 'mobile-screen',
  actions = { { id = 'sim', label = 'Swap SIM', icon = 'sim-card' } },
}

Each entry adds a context menu item. When a player picks it, the server runs the action hook (which can veto) and fires a local server event:

lua
AddEventHandler('np_inventory:server:action', function(src, action, item, inventoryId, slot)
  if action == 'sim' then
    -- item is a copy: { name, label, slot, count, metadata, … }
  end
end)

Labels are localised with action_<id>. Built-in actions that need no entry: show (documents), open (bags), unload and detach (weapons), rename (unique items), split, drop, use.

Metadata ​

Every slot has a metadata table. These keys mean something to np_inventory:

Key Meaning
label Player-given name of a unique item (rename action)
description / image Per-instance description / image
durability 0–100
created / expires / decayRate Decay timestamps (unix seconds) and the cooler factor while inside one
serial / registered Weapon serial and registered owner
ammo / components Rounds in the weapon / attachment item names
fuel Litres left in a jerry can
container Bag inventory uid
quality 1–5 stars (crafting chance rolls)
plate Car keys
number Phone number
weight Extra grams per unit (bags store their contents' weight here)
name, birthdate, nationality, sex, issued, idnumber Document fields
evidence Case number of the evidence locker
display { { label, value, icon? } } rows shown as they are

The tooltip and the selected-item panel show the known keys with labels and icons: serial, a durability or freshness bar, ammo as 9 / 12, attachments, registered owner, quality stars, plate, number, fuel (12 L) and document fields.

To show your own keys:

lua
-- 1. per instance: rows shown as they are
exports.np_inventory:AddItem(src, 'evidence_bag', 1, {
  display = { { label = 'Case', value = '2026-118' }, { label = 'Found at', value = 'Vespucci Beach' } },
})

-- 2. for every item: list the key with its label (shared/config.lua) ...
Config.ShowMetadataKeys = { flavour = 'Flavour' }      -- or { 'flavour' }
-- ... or from a client script
exports.np_inventory:displayMetadata('flavour', 'Flavour')
exports.np_inventory:displayMetadata({ vin = 'VIN', mileage = 'Mileage' })

A key listed without a label uses the web string ui.meta.<key> from the locale files when there is one, otherwise the raw key.

Two stacks merge only when their metadata is equal. List keys in Config.StackIgnoreMetadata to ignore them for that check.

Localisation ​

Item, description, category and action texts come from the config in English. The locale files override them per language:

lua
-- shared/locales/de.lua
item_water = 'Wasser',
itemdesc_water = 'Stilles Wasser, 0,5 l.',
cat_drink = 'Getränke',
action_sim = 'SIM tauschen',

Built-in items ​

Group Items
Money & documents money, black_money, id_card, driver_license, weapon_license
Electronics & keys phone, radio, laptop, camera, car_keys
Tools lockpick, repairkit, toolbox, jerrycan, spare_tire, lighter
Medical bandage, medikit, painkillers, adrenaline
Food & drinks water, coffee, sandwich, donut, burger, fish
Misc & illegal cigarettes, weed, goldchain
Materials steel, plastic, wire, cloth
Bags backpack (equips: +20 kg), duffel_bag, cooler (food lasts four times longer)
Clothing armour_vest, cap, mask, glasses, gloves
Weapons weapon_pistol, weapon_combatpistol, weapon_stungun, weapon_smg, weapon_carbinerifle, weapon_pumpshotgun, weapon_knife, weapon_bat, weapon_nightstick, weapon_flashlight, weapon_petrolcan
Ammo ammo_9, ammo_45, ammo_smg, ammo_rifle, ammo_shotgun
Attachments at_suppressor, at_flashlight, at_clip_extended

/itemlist [filter] prints every item with its weight and category.

Coming from ox_inventory or qb-inventory ​

ox_inventory (data/items.lua) qb-core (shared/items.lua) np_inventory
label, weight, description label, weight, description same
stack = false unique = true stack = false
close shouldClose close
consume (amount per use) consume is a table of status deltas; one unit is always removed
client.status = { hunger = … } consume = { hunger = … } (in %, 0–100)
client.anim, client.prop, client.usetime, client.disable use.anim, use.prop, use.duration, use.disable
client.event, client.export client.event, client.export
server.export (usingItem, usedItem, buying) QBCore.Functions.CreateUseableItem server.export with the same events, or keep the framework callback (above)
client.image image image (file name under Config.ImagePath)
degrade (minutes) decay (seconds) for food, durability + degrade (per use) for tools
weapons in data/weapons.lua type = 'weapon' weapon = { hash, ammo, clip, wear }