All products

np_inventory

An inventory built on slots, weight in grams and per-item metadata. Pockets, bags, trunks, stashes, shops and crafting benches share the same screen. It answers the ox_inventory and qb-inventory exports, so your existing scripts keep working.

v0.1.0qbx · qb · ESX · standaloneNeeds oxmysqlRequires np_prophandler 1.1.0+ox_inventory / qb-inventory exports
Price TBAStore link follows at release
Installation guideDocumentation
Version
0.1.0
Frameworks
qbx, qb, ESX, standalone
Dependencies
oxmysql, np_prophandler 1.1.0+
Database
5 tables, created at start
Replaces
ox_inventory, qb-inventory (through provide)
Languages
English, German
Build
Node 18+ once, to build the NUI
Admin
np_admin permission np_inventory.admin: /giveitem, /clearinv, /openinv, /itemlist
Pockets with the hotbar on slots 1–5, the detail panel of a pistol with serial, condition, magazine, attachment and registered owner, and a vehicle trunk with Take all
Pockets with the hotbar on slots 1–5, the detail panel of a pistol with serial, condition, magazine, attachment and registered owner, and a vehicle trunk with Take all

Taken from the NUI in the browser mock at 1920×1080. Most shots show the German UI; English ships too.

What's in it

An item fits only when a slot is free (or it stacks) and the weight holds, and the UI says which limit it hit. Stacks merge only when their metadata is equal.

Pockets and equipment

  • 25 slots and 85 kg by default, with a hotbar on slots 1–5 that works while the inventory is closed.
  • Equipment: head, mask, glasses, vest, bag, primary, secondary and hands. A backpack adds 20 kg, a vest gives armour that wears down with the damage you take.
  • Bags open as their own inventory and keep their contents through drops, trunks, gives and trades. Coolers slow down food decay.
  • Overload chip: no sprinting above 100 %, no picking up above 120 %.

Stashes, trunks, drops

  • Trunks and gloveboxes sized per vehicle class, with per-model overrides and a front trunk for mid-engine cars.
  • Stashes: job and gang (with a minimum grade), personal (one per character), fixed owner or PIN.
  • Ground drops, searchable dumpsters and bins with loot rolls and cooldowns, and temporary stashes for loot crates.
  • TAB opens the closest trunk, glovebox, drop, stash or robbable player next to your pockets.

Shops

  • A cart with cash or card, or items priced in black money.
  • Stock with timed restock, saved in the database. Job discounts shown in the header.
  • Locks: licence (weapon, driver) and job or gang per item. Locked items stay visible with the reason.
  • Shipped: a 24/7, Ammu-Nation, YouTool and an EMS-only pharmacy. They step aside on their own while np_shops runs.

Crafting

  • Up to 10 crafts per bench in a queue that runs on server time, also while the player is away or offline.
  • Tools that must be there but aren't used up, job and skill locks, and a chance-based quality roll.
  • Ingredients come from the pockets, then the equipped bag, then the bench storage.
  • Cancel gives back exactly what was used, with each item's own durability, freshness and serial.

Give and trade

  • Give: pick a player within 3 m. Names stay anonymous ("Person #12") until they know each other.
  • Trade: up to 8 items and cash per side. Both lock, both confirm, then a 3 s countdown.
  • Any change on either side resets both locks. The swap is atomic: if one check fails, nothing changes.

Robbing and police

  • Robbing only works when the target has hands up (X), is cuffed or downed, re-checked on every move.
  • Frisk: on-duty police first get a pat-down that shows only weapons, ammo and illegal items. The rest stays on the server until a full search.
  • Evidence locker with case numbers. Confiscate and return exports for jail or impound.

Weapons and items

  • Weapons are items with a serial number, registered owner, ammo in the magazine, attachments (incl. extended magazines), wear per shot and jams below 15 %.
  • Reload from ammo items with R, unload back into ammo. The weapon wheel is off, weapons come from the hotbar.
  • Use with progress bar, animation and prop. Durability per use, food that spoils, ID cards and licences shown to the nearest player.
  • Built-in items: repair kit, spare tire, jerry can, lockpick, adrenaline shot, radio and phone work out of the box.

Dupe protection and logs

  • Every inventory lives in server memory and every change is atomic. The client never decides what it owns.
  • Each action is an RPC with a schema, a rate limit and a session check. Distance, access and the vehicle lock are re-checked on every move.
  • A stale client gets fresh views instead of duplicating items. The server checks the elapsed time of a use, so progress bars can't be skipped.
  • Logs of gives, trades, drops, pick-ups, purchases, crafts, robberies, frisks and admin actions in the database, and optionally a Discord webhook.

Set it up

Coming from ox_inventory or qb-inventory

np_inventory registers the common ox_inventory and qb-inventory exports under its own name. Uncomment one provide line and remove the old inventory, and calls to exports.ox_inventory or exports['qb-inventory'] reach np_inventory without changes.

FrameworkWhat you doWhat keeps working
qbx_coreRemove ox_inventory, uncomment provide 'ox_inventory', set Config.Framework = 'qbx'Player.Functions.AddItem / RemoveItem / HasItem, CreateUseableItem and scripts written for ox_inventory
qb-coreRemove qb-inventory, uncomment provide 'qb-inventory'Player.Functions.AddItem / RemoveItem / GetItemByName / HasItem, CreateUseableItem, and Player.PlayerData.items is kept up to date
es_extendedDon't run another inventory. Optional: Config.Esx.overrideInventory = true (ESX Legacy 1.9+)Cash and black money synced with the ESX accounts, ESX.RegisterUsableItem. With the override, xPlayer.addInventoryItem, getInventoryItem, canCarryItem and the rest call np_inventory
StandaloneNothingCharacters from np_character when it runs, otherwise the player's licence identifier owns the inventory
-- np_inventory/fxmanifest.lua: uncomment the one you need
provide 'ox_inventory'    -- qbx_core, and scripts written for ox_inventory
provide 'qb-inventory'    -- qb-core, and scripts written for qb-inventory

Player inventories are imported once

The first time a character loads without an np_inventory row, its old inventory column is read and the pockets are filled from it (Config.ImportLegacy, on by default). Old rows stay in place, the import only reads them.

FrameworkColumn readWritten by
qbx / qbplayers.inventoryox_inventory on qbx, qb-inventory on qb
ESXusers.inventoryESX's own inventory, or ox_inventory on ESX
  • Item names must match. Unknown items are kept aside in the row and come back once you define them. ox weapon names like WEAPON_PISTOL resolve to the lowercase item. ox ammo (ammo-9) is ammo_9 here, so rename one side before players log in.
  • Metadata is taken as it is. ox's serial, registered, durability, ammo and components match. qb's info is copied into metadata unchanged.
  • Stacks of unique items are split (5 lockpicks become 5 items). What doesn't fit goes into a bag on the ground next to the player.
  • Not imported: stashes, trunks, gloveboxes and shop stock start empty.

Item definitions

Items live in shared/config/items.lua and weapons.lua, weights in grams per unit. ox's data/items.lua is not read, so copy your definitions over. Most fields map one to one.

ox_inventoryqb-corenp_inventory
stack = falseunique = truestack = false
closeshouldCloseclose
client.statusconsume = { hunger = … }, one unit per use
client.anim, .prop, .usetimeuse.anim, use.prop, use.duration
server.exportCreateUseableItemserver.export with usingItem, usedItem, buying, or keep the framework callback
degrade (minutes)decay (seconds) for food, durability + degrade per use for tools
data/weapons.luatype = 'weapon'weapon = { hash, ammo, clip, wear }

Compatibility

The framework is detected once at start (qbx, then qb, then ESX, then standalone), or set it in Config.Framework. Every bridge call is wrapped, so a missing export degrades instead of erroring.

KindSupported
Frameworkqbx_core, qb-core, es_extended (+ esx_status for hunger and thirst, esx_license for licences), or standalone
Databaseoxmysql and np_prophandler 1.1.0+ (drops, held items), the only hard dependencies
Inventory APIsox_inventory and qb-inventory exports, through provide
Fuel (jerry can)ox_fuel, LegacyFuel, cdn-fuel, ps-fuel, or the native fuel level
Radio itemqb-radio, or a pma-voice channel prompt
HUDnp_hud for hotbar, progress, prompts and toasts. Without it np_inventory draws its own
qbx / qbESXStandalone
Ownercitizenididentifiernp_character CID, else the licence identifier
MoneyFrameworkAccounts (black money synced)np_inventory_money table
Jobs and groupsJob and gang gradeJob grade, admin groupnp_admin nodes
Licences for shopsmetadata.licencesesx_licensenp_admin node or a <name>_license item
Hunger, thirst, stress✓esx_statusEvent for your own script
Crafting skill locks✓– (or Config.Skills.get)– (or Config.Skills.get)
Persistent trunksplayer_vehiclesowned_vehiclesSetVehicleOwned export

Installation

Needs oxmysql, np_prophandler 1.1.0+, a recent FiveM artifact (Lua 5.4) and Node 18+ to build the NUI once.

  1. Put the resource in resources/ as np_inventory. Keep the name, the NUI callbacks use it.
  2. Build the NUI (web/dist is not committed):
    cd web && npm ci && npm run build
  3. Database: the tables are created at start (Config.AutoCreateTables), or import sql/np_inventory.sql yourself.
  4. Remove your old inventory and set up the framework as in Migrating.
  5. Add it to server.cfg. Permissions are managed in np_admin: grant np_inventory.admin to your staff there, no add_ace lines. On qbx, np_inventory starts before qbx_core:
    ensure oxmysql
    ensure np_hud           # optional
    ensure np_admin         # optional: permissions, settings, logs
    ensure np_prophandler   # required, 1.1.0+
    ensure np_inventory     # qbx: before qbx_core
    # optional, set (not setr) so clients never see it:
    set np_inventory_webhook "https://discord.com/api/webhooks/…"
  6. Copy your item definitions into shared/config/items.lua, then press TAB in game. /giveitem <id> water 3 and /itemlist help you test.
TableHolds
np_inventoryOne row per persisted inventory, items as JSON
np_inventory_logsAction, actor, target, inventories, item, count, metadata, coordinates
np_inventory_craftingCrafting queue per character and bench
np_inventory_shopsShop stock
np_inventory_moneyStandalone only: cash, bank, black money

For your own scripts

Export names and signatures follow ox_inventory where they overlap. Hooks let other resources veto moves, uses, gives, purchases, crafts and opens.

-- server: give two waters, but only if they fit
if exports.np_inventory:CanCarryItem(source, 'water', 2) then
  exports.np_inventory:AddItem(source, 'water', 2)
end

-- server: a job locker, one per character (slots, grams, personal, groups)
exports.np_inventory:RegisterStash('lsmd_locker', 'LSMD Locker', 50, 200000,
  true, { ambulance = 0 })

-- server: no weed in drops
exports.np_inventory:registerHook('beforeMove', function(payload)
  if payload.toType == 'drop' then return false, 'Not here.' end
end, { itemFilter = { weed = true } })

Questions

Can it replace ox_inventory on qbx?

Yes. qbx_core talks to its inventory only through ox's exports. Remove ox_inventory, uncomment provide 'ox_inventory' and set Config.Framework = 'qbx'. A few ox exports are not implemented, among them SetItem, InspectInventory and ox's server events; the compatibility page lists them.

Do my players lose their items when I switch?

No. Pockets are imported once from players.inventory (qbx, qb) or users.inventory (ESX) when a character first loads, as long as the item names exist in your config. Stashes, trunks, gloveboxes and shop stock start empty.

Do ESX's own inventory functions still work?

By default xPlayer.addInventoryItem and the other xPlayer inventory functions work on ESX's inventory, not np_inventory. Set Config.Esx.overrideInventory = true (ESX Legacy 1.9+) and those functions call np_inventory for players who log in after it started.

Is cash an item or an account?

Either. In item mode the money item is synced both ways with the framework cash, so it can be dropped, robbed and traded. On ESX black_money is synced with the black money account the same way. Account mode keeps cash in the framework.

How does it stop duplication?

Inventories live in server memory and every change is atomic. Each action is a rate-limited RPC with a schema and a session check, distance and access are re-checked on every move, and a stale client gets a fresh view instead of a copy. The test suite includes regression tests for duplication paths and fuzzing of every RPC.

Which languages are included?

English and German. Players pick their language and the frosted or Liquid Glass material in the settings; the server sets the defaults and a brand colour.

Works well with

Swap the inventory, keep your scripts.

Installation, migration, every item field and every export are in the docs.

Install np_inventory