Skip to the content
Docs

Inventories

On this page10
lua
Config.InventorySystem = 'auto'

The inventory carries the five items and, where it can, their metadata — the device serial, the battery level, the report id. Where it cannot, the script keeps that identity in its own table and the item is just a token.

Item definitions to paste: Items.

Support and auto order

SystemSupportAuto orderMetadataUsable-item registration
ox_inventorySupported1yesframework, or server.export on ox_core / standalone
qs-inventorySupported2yesits own CreateUsableItem
jaksam_inventorySupported3yesits own registerUsableItem
tgiann-inventorySupported4yesframework
ak47_qb_inventorySupported5yesframework
ak47_inventorySupported6yesframework
origen_inventorySupported7yesframework
codem-inventorySupported8yesframework
core_inventorySupported9yesframework
ps-inventoryStub10through qb-coreQBCore.Functions.CreateUseableItem
lj-inventoryStub11through qb-coreQBCore.Functions.CreateUseableItem
qb-inventory v2Supported12yesQBCore.Functions.CreateUseableItem
ESX defaultSupported13no → our database fallbackESX.RegisterUsableItem
standalone (none)Supported14virtual items/recognition:use

qb-inventory is only picked on qb-core, never on Qbox — Qbox runs ox_inventory.

ox_inventory

The most complete integration. Devices carry their serial, battery and preset; papers carry their report id; the battery shows as a durability bar.

Which "use" path

ox calls your framework's usable-item callback only for items with no consume value of their own. Giving an item a server.export switches it to the export path and the framework callback is never called again. Pick one:

Your setupWhat to do
ESX, QBCore, QboxNothing. We register the items through the framework.
ox_core, standalone, custom frameworkAdd consume = 0 and server = { export = '5code-recognition.useItem' } to each of the five items.

The durability bar

Config.Battery.ShowAsDurability = true (the default) draws the battery as ox's durability bar. ox then refuses to use an item at 0 % and shows no_durability — which is intended: a flat device is recharged with a separate battery item, not by using the dead device. Set it to false to drop both.

Our useItem export

5code-recognition.useItem is not open to everyone. Only ox_inventory itself and the resources listed in ServerConfig.Api.TrustedResources are accepted. Anything else is refused, with a warning in the server console naming the resource.

qb-inventory v2, ps-inventory, lj-inventory

Metadata lives in the item's info table. The bridge writes it with SetItemData(source, itemName, 'info', info, slot), and it sets info.display = false on every write.

Register usable items once. We do it ourselves; if your server also registers them, the second registration wins and ours is lost. Pick one side.

qs-inventory

Metadata through SetItemMetadata(src, slot, md), usable items through its own CreateUsableItem.

jaksam, tgiann, ak47, origen, codem, core_inventory

All support metadata, each with its own call:

InventoryMetadata write
jaksam_inventorysetItemMetadataInSlot(src, slot, md)
tgiann-inventoryUpdateItemMetadata(src, item, slot, md)
ak47_inventory / ak47_qb_inventorySetItemInfo(src, slot, info)
origen_inventorysetMetadata(src, slot, md)
codem-inventorySetItemMetadata(src, slot, md)
core_inventoryupdateMetadata(inv, slot, md)

ESX default inventory

No item metadata at all. The script falls back to its own tables:

  • Device identity lives in recognition_devices (serial, owner, battery, preset).
  • Paper identity lives in recognition_reports.

The item in the inventory is a plain token. To move a device or a paper to another player, use:

Code
/recognition:handover <item>

within Config.Report.GiveDistance (2.5 m by default) of the person in front of you.

Standalone — no inventory

With Config.InventorySystem = 'standalone', or no inventory resource at all, the script keeps the items itself in recognition_items:

Code
[5code-recognition] standalone: items are kept by the script (use /recognition:use).
CommandWhat it does
/recognition:itemsList what your character carries.
/recognition:use <item>Use one.
/recognition:handover <item>Hand a device to the person in front of you.
/recognition:giveitem <id> <item> [count]Admin (edit level): hand one out.

Two server exports do the same from your own code, for trusted resources: GiveItem and TriggerItemUse.

Missing item definitions

Code
[5code-recognition] Missing item definitions: voice_changer, hidden_camera. See docs: Getting Started > Items.

The rest of the script keeps working. Only those devices cannot be handed out.

Renaming an item

Change it in both places — your inventory's item list and Config.Items — and rename the image to match.

lua
Config.Items = {
    VoiceChanger    = 'voice_changer',
    HiddenCamera    = 'hidden_camera',
    MagneticScanner = 'magnetic_scanner',
    Battery         = 'recognition_battery',
    Report          = 'recognition_report',
}

Custom

Set Config.InventorySystem = 'custom' and fill the 'custom' branch in bridge/inventory.lua. The core needs: does the player have this item, add one, remove one, read and write metadata for a slot, and register a usable item.

See Writing a Custom Adapter.