Installation ​
Requirements ​
- A recent FiveM server artifact (Lua 5.4)
- oxmysql
- np_prophandler 1.1.0+: the props of ground drops and the props held during a use or hand-over. Start it before np_inventory
- Node 18+ to build the NUI once
Optional, auto-detected at start:
| Kind | Resources | Used for |
|---|---|---|
| Framework | qbx_core, qb-core, es_extended | Character id and name, money, jobs and gangs, downed / cuffed state, vehicle ownership, licences, hunger / thirst / stress, usable items. Without one, np_inventory runs standalone |
| ESX add-ons | esx_status, esx_license |
Hunger / thirst on ESX, licences for shop locks |
| HUD | np_hud | Progress bars, prompts and toasts. Without it, np_inventory renders its own |
| Characters | np_character | Character ids in standalone mode, and the np_character:loaded event on every framework |
| Staff | np_admin | Permissions, live settings, the audit log and staff actions. Without it, a fallback decides who is staff |
Steps ​
- Put the resource in
resources/asnp_inventory. The NUI callbacks usehttps://np_inventory/…, so keep the name. - Build the NUI:shThis creates
cd web && npm ci && npm run buildweb/dist, whichfxmanifest.lualoads as theui_page.web/distis not committed, so a fresh clone starts with a blank UI until you build it. - Database: with
Config.AutoCreateTables = true(the default) the tables are created at start. Otherwise importsql/np_inventory.sqlyourself. See Bridges → Tables. - Remove your old inventory and set up the framework (next section).
- Add to
server.cfg(start order per framework below). np_prophandler must start before np_inventory. np_admin is optional; start it before np_inventory as well:cfgThere are noensure np_prophandler ensure np_admin # optional: permissions, settings, logs, staff tools ensure np_inventoryadd_acelines: staff get thenp_inventory.adminnode in np_admin (see Permissions). - Optional: a Discord webhook for the logs. Use
set, notsetr, so clients never see it:cfgThe convar wins overset np_inventory_webhook "https://discord.com/api/webhooks/…"Config.Logs.webhook. Onlyhttps://URLs are used.
Framework setup ​
qbx_core ​
qbx_core hard-depends on ox_inventory and talks to it through its exports. np_inventory takes its place:
- Remove (or stop)
ox_inventory. - Uncomment
provide 'ox_inventory'in np_inventory'sfxmanifest.lua. - Set
Config.Framework = 'qbx'inshared/config.lua. qbx_core now depends on np_inventory, so it starts after it and auto-detection can't see it yet. With an explicit'qbx'the bridge loads anyway and finds qbx_core once it runs.
ensure oxmysql
ensure np_prophandler
ensure np_inventory # provides ox_inventory
ensure qbx_core
ensure np_hud # optional
qbx_core's Player.Functions.AddItem, RemoveItem, HasItem … and every script written for ox_inventory now reach
np_inventory. See Compatibility → ox_inventory.
qb-core ​
qb-core's Player.Functions.AddItem / RemoveItem / GetItemByName / HasItem … call exports['qb-inventory'].
- Remove (or stop)
qb-inventory. - Uncomment
provide 'qb-inventory'infxmanifest.lua.
ensure oxmysql
ensure qb-core
ensure np_prophandler
ensure np_inventory # provides qb-inventory
ensure np_hud # optional
np_inventory also keeps Player.PlayerData.items up to date for scripts that read it. Starting np_inventory before
qb-core works as well, but then set Config.Framework = 'qb'. See
Compatibility → qb-inventory.
es_extended ​
Don't run another inventory. Start np_inventory after ESX:
ensure oxmysql
ensure es_extended
ensure esx_status # optional: hunger / thirst
ensure esx_license # optional: licences for shop locks
ensure np_prophandler
ensure np_inventory
In item mode, cash and black money are synced with the ESX accounts. ESX's own xPlayer.addInventoryItem /
removeInventoryItem / getInventoryItem / canCarryItem are not redirected by default. Either use the
exports in your scripts, or set Config.Esx.overrideInventory = true (ESX Legacy 1.9+) so these
functions call np_inventory for every player who logs in after np_inventory started. See
Compatibility → ESX.
Standalone ​
Nothing to set up. With np_character running, inventories belong to the character (its CID);
otherwise the player's license is the owner. Money lives in the np_inventory_money table, groups come from np_admin
permission nodes and licences from nodes or items (see Bridges → Standalone).
ensure oxmysql
ensure np_character # optional
ensure np_prophandler
ensure np_inventory
np_hud ​
With Config.UseNpHud = 'auto' (the default), progress bars, prompts and toasts go through np_hud while it
runs.
Start np_hud before np_inventory. The hotbar, the item feed, the overload chip and every inventory screen stay in np_inventory.
Migrating from ox_inventory or qb-inventory ​
Player inventories are imported once. The first time a character loads and np_inventory has no row for it, it
reads the framework's old inventory column and fills the pockets from it (Config.ImportLegacy = true, the default):
| Framework | Column read | Written by |
|---|---|---|
| qbx / qb | players.inventory |
ox_inventory on qbx, qb-inventory on qb |
| esx | users.inventory |
ESX's own inventory, or ox_inventory on ESX |
Keep in mind:
- Item names must match. An imported item whose name isn't in
Config.Itemsis kept aside in the row (never deleted) and comes back once you define it. ox weapon names (WEAPON_PISTOL) resolve to the lowercase item. ox ammo is calledammo-9,ammo-rifle, …; np_inventory's isammo_9,ammo_rifle, so either define items with the old names or rename the new ones before players log in. - Metadata is taken as it is. ox metadata (
serial,registered,durability,ammo,components) matches np_inventory's keys. qb'sinfois copied intometadataunchanged, so qb-only keys such asseriestay as they are. - Stacks of unique items are split. An item that is unique in np_inventory but was stored as a stack (5
lockpicks) becomes 5 single items. What doesn't fit into the pockets goes into a bag on the ground next to the
player (logged as
import). - Stashes, trunks, gloveboxes and shop stock are not imported. They start empty.
- Copy your item definitions over: see Items for the fields and how ox / qb fields map.
- Old rows stay in place. The import only reads them.
Test it
Join the server and press TAB: your pockets open with the hotbar in slots 1–5. As an admin, /giveitem <your server id> water 3 gives you water and /itemlist lists every item. Drop something with Q and pick it up again with E.
Permissions ​
np_inventory uses no ACE. Every check is a permission node, managed in np_admin: grant
the nodes to an np_admin group or a single player (wildcards like np_inventory.* work, an explicit deny wins).
| Node | Grants |
|---|---|
np_inventory.admin |
The admin commands /giveitem, /clearinv, /openinv, /itemlist and the np_admin staff actions (Resource tools) Give item, Clear inventory, Open inventory, Open stash / inventory id. The server console is always allowed |
np_inventory.group.<name> |
Standalone only: membership of job / gang <name> for stash, shop, bench and police checks. The groups used in the config are listed in np_admin |
np_inventory.license.<name> |
Standalone only: licence <name> (weapon, driver) for shop locks (otherwise a <name>_license item) |
Without np_admin running, only these pass a check:
- the server console;
- the identifiers in the convar
np_admin_fallback(set np_admin_fallback "license:abc…,discord:123…"); - on es_extended, the ESX groups in
np_admin_fallback_groups(defaultadmin,superadmin).
Everyone else is refused, including the standalone group and licence nodes. See Concepts → Permissions.
Troubleshooting ​
| Symptom | Fix |
|---|---|
| Blank UI, nothing opens | web/dist is missing. Build the NUI |
| qbx_core doesn't start ("dependency ox_inventory") | Uncomment provide 'ox_inventory' in fxmanifest.lua and start np_inventory before qbx_core |
| Money, jobs or names are empty | The framework started after np_inventory, so 'auto' picked standalone. Fix the start order or set Config.Framework |
framework bridge "…" selected but resource "…" is missing |
Config.Framework names a framework that isn't installed |
Scripts calling exports['qb-inventory'] or exports.ox_inventory fail |
The matching provide line is still commented out, or the original inventory is still running |
| Imported items missing | Their names aren't in Config.Items. They are kept aside: define the items and they come back on the next load |
| Trunk forgets its items | Unowned vehicles are memory-only. The plate must be in the framework's vehicle table, or call SetVehicleOwned(plate, true) |
/giveitem says "no permission" |
Grant the np_inventory.admin node to your group in np_admin. Without np_admin, add your identifier to np_admin_fallback (or use an ESX group from np_admin_fallback_groups) |
| Standalone: a player can't open a job stash or shop | Grant np_inventory.group.<name> in np_admin. add_ace / group.<name> aces are no longer read |