Requirements#
- OneSync on (
set onesync onin server.cfg, or the OneSync setting in txAdmin). The server reads player peds and vehicles for reach checks, clothing checks, ground drops, trunks, gloveboxes and car keys. With OneSync off those fail, and the console prints a warning at start. - oxmysql is optional. Without it everything is saved in the server's own KVP store (unless
Config.Database.preferis'none', which saves nothing). You need oxmysql for:invmigrate, which brings over another inventory's saved data;- keeping the trunks and gloveboxes of owned vehicles, and owner-only trunks (the framework's vehicle table is read through oxmysql);
- the starter kit's check, on a framework, that a character is really new.
- No ox_lib and no build step are needed.
- A framework is optional: ESX, QBCore, QBox, ND_Core or ox_core. Without one there are no jobs or police checks, no bank accounts and no licenses, and money is the
cashitem. - QBox and ESX Legacy also need the bundled
ox_inventorycompatibility folder (step 2). - A recent game build is recommended. Some shipped weapons and models come from recent GTA Online updates. On a server that enforces an older build (
sv_enforceGameBuildin server.cfg), those weapons are refused as invalid, and a pile model the build lacks falls back to a plainer one (the console says so once). The Large backpack's model needs build 2545 or newer and the Tactical backpack's needs 2802 or newer; below that they show an older bag model. Setsv_enforceGameBuildto a recent build your FiveM server artifacts support.
Steps#
-
Copy the
ncore_inventoryfolder intoresources/[ncore](create the[ncore]folder if you do not have one yet). Do not rename it. -
QBox and ESX Legacy only: copy the shipped
ox_inventoryfolder, a compatibility layer for ncore_inventory, intoresources/[ncore]next toncore_inventory. Delete any other folder namedox_inventoryfirst (stopping it is not enough). Do not lower itsversionline and do not addprovide 'ox_inventory': qbx_core reads that version and stops the server when it fails its check. QBCore, ND_Core, ox_core and standalone servers do not need this folder. -
Optional: if you run oxmysql, import
sql/install.sqlinto your database. The resource also creates its tables by itself at start, so this is only for owners who prefer to create the schema by hand. See Database below. -
Add the resource to
server.cfg. The framework is detected once, at start, so oxmysql and your framework go aboveensure ncore_inventory. If you use ox_target or qb-target, put it above as well. Resources that callRegisterStash(housing scripts and the like) go below it.Standalone
server.cfgensure oxmysql # optional ensure ncore_inventoryQBCore
server.cfgensure oxmysql ensure qb-core ensure ncore_inventory # your qb- resources after this lineESX Legacy (the bundled compatibility folder goes directly after ncore_inventory)
server.cfgsetr inventory:accounts "[]" ensure oxmysql ensure es_extended ensure ncore_inventory ensure ox_inventoryThe
setr inventory:accounts "[]"line is required on ESX Legacy 1.14 and 1.15. Without it es_extended uses["money", "black_money"], andblack_moneyis also an item in this inventory. es_extended copies every change to that ESX account into the item, and nothing copies the item back, so the two drift apart the first time a player drops or hands over the item. The console prints a warning at every start until the line is set. ESX 1.16 and newer always mirrorblack_moneyinto an item, with no write-back, whatever this line says; there the ESXblack_moneyaccount and theblack_moneyitem are separate balances.On ESX Legacy the console confirms "ESX is in its ox_inventory mode". If it prints a red "ESX IS RUNNING ITS OWN INVENTORY" box instead, follow the fix in that box. ESX 1.1 and 1.2 have no third-party inventory mode: xPlayer item calls keep using ESX's own inventory there, and the console says so at start.
QBox
server.cfgsetr inventory:framework "qbx" # qbx_core shuts the server down without this line ensure oxmysql ensure ox_lib # qbx_core needs it ensure qbx_core ensure ncore_inventory ensure ox_inventoryND_Core or ox_core: ensure the framework (and what it needs itself), then
ensure ncore_inventory.A framework that starts after ncore_inventory is not picked up. The console names it and tells you to move its
ensureline above. -
Grant the admin ace:
server.cfgadd_ace group.admin lri.admin allow add_principal identifier.license:<license> group.adminlri.admincovers every admin part (lri.admin.panel,.edit,.give,.capacity,.storage,.shops,.economy,.logs,.config,.pose) and premium coins (lri.admin.premium). For smaller staff roles grant single parts instead;lri.admin.panelis always needed to open the panel. The test lab has its ownlri.labace, for test servers only. A VIP capacity tier is granted withadd_ace group.vip lri.tier.vip allow.Make sure
Config.Debug.commandsisfalseinconfig.lua(that is how it ships).You can switch on the extra console lines (
Config.Debug.console) fromserver.cfgwithout touchingconfig.lua. The convar wins over the config value, and it never turns on the test commands:server.cfgsetr ncore_inventory:debug true -
Language: with
Config.Locale = 'auto'the server picks one language for everyone from thelr:locale,locale,ox:locale,esx:localeortxAdmin-localeconvar, in that order, and otherwise uses English. The shipped languages areen,hu,de,fr,es,pt-br,plandtr. GTA has no Hungarian or Turkish game language, so a Hungarian or Turkish server setsConfig.Locale = 'hu'(or'tr') or addssetr lr:locale "hu"to server.cfg. -
Restart, join and press F2. From the server console,
invgive <player id> water 10proves the round trip.
Database#
This section applies only when oxmysql is running and Config.Database.prefer is 'auto' (the default) or 'mysql'. With 'kvp' the server's own KVP store is used, and with 'none' nothing is saved at all, even with oxmysql. The console confirms it at start with storage: oxmysql, table followed by the table name.
The main table is ncore_inventory (the name comes from Config.Database.table). At every start the resource creates it if it is missing and adds any column it lacks. The other tables are created the same way: ncore_inventory_logs (Config.Logs.table), ncore_inventory_placed for storages placed in the world, and ncore_inventory_premium when premium coins are switched on (Config.Premium.enabled).
If the database user has no ALTER right, a missing column cannot be added. The console then prints an error that names the column and the exact statement. Run that statement as a database user with ALTER rights, then restart the resource. For the default table name the statements are:
ALTER TABLE `ncore_inventory` ADD COLUMN `owner` VARCHAR(96) DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `kind` VARCHAR(24) NOT NULL DEFAULT 'player';
ALTER TABLE `ncore_inventory` ADD COLUMN `label` VARCHAR(96) DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `parent` VARCHAR(96) DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `slots` SMALLINT UNSIGNED NOT NULL DEFAULT 24;
ALTER TABLE `ncore_inventory` ADD COLUMN `max_weight` INT UNSIGNED NOT NULL DEFAULT 32000;
ALTER TABLE `ncore_inventory` ADD COLUMN `accepts` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `meta` VARCHAR(1024) DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `data` LONGTEXT DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `modstate` LONGTEXT DEFAULT NULL;
ALTER TABLE `ncore_inventory` ADD COLUMN `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;Run only the lines the console names. If you changed Config.Database.table, use your table name; the console already prints it.
-
Without the
modstatecolumn, module state (crafting queue jobs, what a worn container remembers) lasts only until a restart. WithConfig.Drops.persiston, piles on the ground also last only until a restart, and the console prints the samemodstatestatement for that. -
The
metacolumn must be 1024 characters wide. The resource widens a narrower one at start; if it cannot, the console says how wide it still is, and a row whose meta is longer is not saved until the column is widened. As a user with ALTER rights run this, then restart the resource:SQLALTER TABLE `ncore_inventory` MODIFY COLUMN `meta` VARCHAR(1024) DEFAULT NULL; -
If a column cannot be added to
ncore_inventory_placed, the console tells you to run theCREATE TABLEfor that table fromsql/install.sql.
Test drive in 5 minutes#
- Add the two ace lines from step 5, restart and join.
- Type
/invadmin. The admin panel opens on the Testing tab: a guided tour (326 steps in 42 parts) with setup buttons and "Show on map" buttons that set a waypoint. The shield button in the inventory header opens the panel too. - Open the Items tab and its Kits view. Give yourself food and drink, medical supplies, tools, containers, evidence, every firearm loaded, one of every key item, 1000 of each money item, one of every stackable item, or everything a crafting bench needs. Your own kits go in
Config.Admin.kits. - From the server console:
invgive <id> cash 1000- on standalone and ox_core the cash item is the money shops take. On ESX, QBCore, QBox and ND_Core shops charge the framework's cash account, so use your framework's money command there.invkey <id> vehicle <plate>- cuts a car key for that plate. Using it near the car locks and unlocks it, and so does the L key (Settings, Key Bindings, FiveM, "Lock or unlock the nearest car you hold a key for"). Where a vehicle key resource with its own lock key runs, that resource handles the press.
- On a test server only, set
Config.Debug.commands = trueand addadd_ace group.admin lri.lab allow. That switches on the test lab and the bench commands: the Testing tab's teleport, car and money buttons,invitem,invfill,invmoney <amount> [player id](through the framework's cash account, or the cash item without one) and/invdebughelp. Never do this on a live server: anyone holding thelri.adminace can then create any item and open any inventory.
Important#
- Do not rename the
ncore_inventoryfolder; exports, pictures and the NUI page are found by that name. - Stop every other inventory resource first. This resource refuses to start beside a known one and names it in the console (add your own to
Config.Conflicts.extra). On QBCore also remove qb-weapons; the console warns while it runs. - A shop another resource registers while the inventory is still starting is built as soon as the shop module is up; a refused registration is logged with its reason.
- The Binco counters and the wardrobes stand inside GTA's clothing stores, where clothing resources often have their own spots. With ox_target or qb-target running, the Binco counter opens through the target eye. The wardrobe always keeps its marker and E prompt, also with a target eye. If your clothing resource opens its own menu with E in the same place, one E press opens both: move those points, or add
enabled = falsetowardrobe_storeindata/stashes.luaand tobincoinmodules/shop/shops.lua. - With ncore_character running, its own clerk stands at the Binco counter and the inventory draws no Binco blip of its own, because ncore_character marks the same store. E at the clerk opens the item shop and G opens ncore_character's fitting room. With ox_target or qb-target running, the fitting room is a "Fitting room" option on the target eye instead of G. The wardrobe has its own marker beside the counter.
- qb-pawnshop uses the same Vinewood counter as the shipped pawn shop; keep one of them (
enabled = falseonpawn_downtowninmodules/shop/shops.luaturns ours off). - Saved inventories from another inventory are brought across with
invmigratein the server console (needs oxmysql). The dry run works any time;applyruns only with nobody online. Stashes, trunks and gloveboxes come across from the ox, qb and qs-style sources; from ESX only player inventories (with loadout and accounts) come across. See DOCUMENTATION.md. - A server that ran on KVP and adds oxmysql later gets a console banner.
invmigrate kvpfollowed byinvmigrate kvp applycopies the saved containers from the KVP store into the database; the KVP rows stay where they are. Admin item edits and old log lines stay in KVP, premium coin balances are read from KVP until each one is next saved to the database, and owners that already have rows in the database are skipped. - Keep your own
config.lua: any setting it leaves out is filled in fromshared/defaults.lua. When you update, copy the newshared/defaults.luaover the old one.
