One Studios
Introduction

Backwards Compatibility

Exactly which framework and inventory functions keep working with One Inventory.

One Inventory ships compatibility layers so resources written for other inventories keep working without edits. This page lists exactly what we implement, per framework and per inventory script.

Each compatibility layer auto-disables when the real resource it emulates is actually running. So the ox layer only takes over when ox_inventory is not started, and likewise for qb-inventory. Any name not listed below is intentionally unsupported and will error if called.
Restarting one_inventory in-game can break these exports. It's possible, but not recommended if other scripts rely on its backwards compatibility. The compatibility exports are wired into other resources when they start, so an in-game restart can leave them holding stale references until a full server restart. If you depend on it, prefer a full server restart over restart one_inventory.

Resource auto-detection

We do not register an ox_inventory or qb-inventory resource. one_inventory always runs as one_inventory, so any script that auto-detects its inventory by checking whether ox_inventory or qb-inventory is started will not detect one, and may fall back to a framework default or error out.

This is deliberate: one_inventory itself checks for a running ox_inventory / qb-inventory so it can migrate from them. It can't both detect those resources and pose as one.

For a script that auto-detects the inventory, either:

  • add explicit one_inventory support to it, or
  • if it's open source, adjust its inventory detection to recognise one_inventory (or hard-set it).

The exports below still work regardless; this only affects scripts that branch on which inventory resource is running.

ESX

Exposed as xPlayer methods (via the es_extended patch), so they resolve on any ESX player object exactly as before.

MethodSupportedNotes
addInventoryItem
removeInventoryItem
setInventoryItem
getInventoryItem
hasItem
getInventorySupports the minimal argument.
canCarryItem
canSwapItem
setMaxWeight
getLoadoutReturns {}; weapons live in slots.
setAccountMoney
addAccountMoney
removeAccountMoney
syncInventory

Usable items keep working through ESX's native registry: RegisterUsableItem and GetUsableItems are consumed directly (see Usable Items). On the client, ESX.PlayerData.inventory and ESX.PlayerData.maxWeight stay populated.

QBCore / QBox

Exposed as Player.Functions methods, so they resolve on any QB / QBox player object exactly as before.

MethodSupported
AddItem
RemoveItem
GetItemByName
GetItemBySlot
GetItemsByName
ClearInventory
GetItemCount
HasItem
CanCarryItem
SetInventory

QBCore.Shared.Items and QBCore.Shared.Weapons are populated from One Inventory's definitions, and PlayerData.items is kept in sync, so legacy reads keep working. Usable items keep working through CreateUseableItem (consumed natively). Money methods (AddMoney / RemoveMoney / SetMoney / GetMoney) are intentionally left to QB and kept in sync.

ox_inventory

Available through exports.ox_inventory:Name(...), with the same signatures as ox.

Server exports

ExportSupported
AddItem
RemoveItem
SetItem
GetItem
GetItemCount
Search
GetSlot
GetSlotWithItem
GetSlotIdWithItem
GetSlotIdsWithItem
GetSlotsWithItem
GetEmptySlot
GetCurrentWeapon
GetItemSlots
GetSlotForItem
CanCarryItem
CanCarryAmount
CanCarryWeight
CanSwapItem
SetMaxWeight
SetSlotCount
SetDurability
SetMetadata
GetInventory
GetInventoryItems
ClearInventory
RemoveInventory
registerHook
removeHooks
Items
forceOpenInventory
CustomDrop
CreateDropFromPlayer
InspectInventory
ConfiscateInventory
ReturnInventory
UpdateVehicle
ConvertItems
RegisterShop

ox hook events supported through registerHook: swapItems, buyItem, createItem, openInventory, openShop, usingItem, craftItem (with the itemFilter, inventoryFilter, typeFilter, print options).

Client exports

ExportSupported
Search
GetItemCount
GetPlayerItems
GetPlayerWeight
GetPlayerMaxWeight
GetSlotIdWithItem
GetSlotIdsWithItem
GetSlotWithItem
GetSlotsWithItem
openInventory
openNearbyInventory
Items
closeInventory
useItem
useSlot
getCurrentWeapon
giveItemToTarget
displayMetadata

qb-inventory

Available through exports['qb-inventory']:Name(...), with the same signatures as qb-inventory.

Server exports

ExportSupported
AddItem
RemoveItem
SetItemData
GetItemByName
GetItemBySlot
GetItemsByName
GetItemCount
GetTotalWeight
GetFreeWeight
HasItem
CanAddItem
ClearInventory
SaveInventory
LoadInventory
SetInventory
GetInventory
GetSlots
GetSlotsByItem
GetFirstSlotByItem
UseItem
OpenInventory
OpenInventoryById
CloseInventory
OpenShop
RemoveInventory
ClearStash
CreateShop

Legacy net events supported: qb-inventory:server:useItem, inventory:server:OpenInventory.

Client exports

ExportSupported
HasItem