OrigenNetwork
Docs

Exports · origen_inventory

All exports are registered under the resource name origen_inventory.

This page documents the canonical export names (camelCase). Every export also has a PascalCase legacy alias (e.g. addItemAddItem, getInventoryGetInventory) kept for backward compatibility with scripts that targeted older versions or qb-inventory / ox_inventory.


Server-side exports

Items

addItem(source, item, amount, slot?, info?)boolean

Adds an item to the player inventory. Returns true on success.

lua
exports['origen_inventory']:addItem(source, 'tosti', 1, nil, { quality = 100 })

addItems(source, items)boolean

Adds multiple items at once.

lua
exports['origen_inventory']:addItems(source, {
    { item = 'tosti', amount = 2 },
    { item = 'water_bottle', amount = 1 },
})

removeItem(source, item, amount, slot?)boolean

Removes an item.

lua
exports['origen_inventory']:removeItem(source, 'tosti', 1)

removeItems(source, items)boolean

Removes multiple items at once. Same payload shape as addItems.

lua
exports['origen_inventory']:removeItems(source, {
    { item = 'tosti', amount = 1 },
    { item = 'water_bottle', amount = 1 },
})

getItem(source, item, metadata?)table?

Returns the slot data of the matching item (or nil).

lua
local slot = exports['origen_inventory']:getItem(source, 'phone')

setItem(source, item, amount, slot?, info?)boolean

Sets the item amount in a slot, replacing the previous value.

lua
exports['origen_inventory']:setItem(source, 'water_bottle', 5, 3)

canCarryItem(source, item, amount)boolean

Returns true if the player can carry the given amount.

lua
local canCarry = exports['origen_inventory']:canCarryItem(source, 'tosti', 5)

canSwapItem(source, fromItem, fromAmount, toItem, toAmount)boolean

Checks whether the player can swap fromItem for toItem.

lua
local canSwap = exports['origen_inventory']:canSwapItem(source, 'tosti', 1, 'water_bottle', 1)

getItemCount(source, item)number

Returns the total amount of an item in the player inventory.

lua
local count = exports['origen_inventory']:getItemCount(source, 'tosti')

getSlot(source, slot)table?

Returns the data of the specified slot.

lua
local slot = exports['origen_inventory']:getSlot(source, 1)

getSlotsIdWithItem(source, item)number[]

Returns every slot id holding the given item.

lua
local slots = exports['origen_inventory']:getSlotsIdWithItem(source, 'tosti')

getSlotWithItem(source, item)table?

Returns the first slot data holding the given item.

lua
local slot = exports['origen_inventory']:getSlotWithItem(source, 'phone')

addItemMetadata(source, item, slot, metadata)boolean

Merges metadata into an existing slot.

lua
exports['origen_inventory']:addItemMetadata(source, 'phone', 1, { battery = 80 })

removeItemMetadata(source, item, slot, keys)boolean

Removes one or more metadata keys from a slot.

lua
exports['origen_inventory']:removeItemMetadata(source, 'phone', 1, { 'battery' })

setMetadata(source, slot, metadata)boolean

Replaces the slot metadata entirely.

lua
exports['origen_inventory']:setMetadata(source, 1, { quality = 100, serial = 'XYZ-123' })

setUses(source, slot, uses)boolean

Sets the remaining uses for a slot.

lua
exports['origen_inventory']:setUses(source, 1, 3)

getItemLabel(item)string

Returns the display label of an item.

lua
local label = exports['origen_inventory']:getItemLabel('tosti')

Inventories

getInventory(identifier)table?

Returns the inventory data for a given identifier (player id, stash id, plate, etc.).

lua
local inv = exports['origen_inventory']:getInventory('faction_locker_1')

getItems(identifier)table[]

Returns every item slot in the given inventory.

lua
local items = exports['origen_inventory']:getItems('faction_locker_1')

setInventory(identifier, items)boolean

Replaces the contents of the given inventory.

lua
exports['origen_inventory']:setInventory('faction_locker_1', {
    { slot = 1, name = 'tosti', amount = 5, info = {} },
})

clearInventory(identifier)boolean

Empties an inventory.

lua
exports['origen_inventory']:clearInventory('faction_locker_1')

setMaxWeight(identifier, weight)boolean

Sets the maximum weight of the given inventory.

lua
exports['origen_inventory']:setMaxWeight('faction_locker_1', 200000)

setMaxSlots(identifier, slots)boolean

Sets the maximum slot count of the given inventory.

lua
exports['origen_inventory']:setMaxSlots('faction_locker_1', 50)

saveInventory(identifier)boolean

Forces a save of the inventory state to the database.

lua
exports['origen_inventory']:saveInventory('faction_locker_1')

useSlot(source, slot)void

Triggers the use action for the given slot, identical to the player clicking on it.

lua
exports['origen_inventory']:useSlot(source, 1)

Player helpers

These exports are convenience wrappers around the player inventory.

OpenInventory(source, identifier?, data?)void

Opens an inventory on the client. When identifier is nil opens the player inventory; otherwise opens the matching stash, trunk or glovebox.

lua
exports['origen_inventory']:OpenInventory(source) -- player inventory
exports['origen_inventory']:OpenInventory(source, 'evidence_locker', { slots = 50, maxweight = 200000 })

OpenInventoryById(source, identifier, data?)void

Opens an arbitrary inventory by id. Useful for evidence lockers, faction stashes, etc.

lua
exports['origen_inventory']:OpenInventoryById(source, 'evidence_locker_42')

LoadInventory(source)void

Reloads the player inventory from the database.

lua
exports['origen_inventory']:LoadInventory(source)

GetPlayerInventory(source)table

Returns the entire player inventory snapshot (all slots).

lua
local inv = exports['origen_inventory']:GetPlayerInventory(source)

SetInventoryItems(source, items)boolean

Bulk-replaces every slot in the player inventory.

lua
exports['origen_inventory']:SetInventoryItems(source, {
    { slot = 1, name = 'tosti', amount = 1, info = {} },
})

SetInventoryData(source, data)boolean

Replaces the entire data envelope (items + metadata) of the player inventory.

lua
exports['origen_inventory']:SetInventoryData(source, { items = {}, weight = 0 })

GetTotalWeight(source)number

Returns the current total weight.

lua
local weight = exports['origen_inventory']:GetTotalWeight(source)

HasItem(source, item, amount?)boolean

Returns whether the player has at least amount (default 1) of the item.

lua
if exports['origen_inventory']:HasItem(source, 'phone') then
    -- player has a phone
end

GetItemsByName(source, item)table[]

Returns every slot occupied by the given item.

lua
local slots = exports['origen_inventory']:GetItemsByName(source, 'tosti')

GetSlotsByItem(source, item)number[]

Returns the slot ids occupied by the given item.

lua
local slotIds = exports['origen_inventory']:GetSlotsByItem(source, 'tosti')

GetItemBySlot(source, slot)table?

Returns the item in a given slot.

lua
local item = exports['origen_inventory']:GetItemBySlot(source, 1)

GetFirstSlotByItem(source, item)number?

Returns the first slot id holding the item.

lua
local slotId = exports['origen_inventory']:GetFirstSlotByItem(source, 'phone')

GetItemTotalAmount(source, item)number

Returns the total amount of the item.

lua
local total = exports['origen_inventory']:GetItemTotalAmount(source, 'tosti')

GetItemByMetadata(source, item, key, value)table?

Returns the first slot whose metadata key equals value.

lua
local slot = exports['origen_inventory']:GetItemByMetadata(source, 'phone', 'serial', 'XYZ-123')

GetItemsByMetadata(source, item, key, value)table[]

Returns every slot whose metadata key equals value.

lua
local slots = exports['origen_inventory']:GetItemsByMetadata(source, 'phone', 'carrier', 'verizon')

GetItemByMetaKey(source, item, key)table?

Returns the first slot whose metadata contains the given key.

lua
local slot = exports['origen_inventory']:GetItemByMetaKey(source, 'phone', 'serial')

GetItemsByMetaKey(source, item, key)table[]

Returns every slot whose metadata contains the given key.

lua
local slots = exports['origen_inventory']:GetItemsByMetaKey(source, 'phone', 'serial')

GetItemInfoBySlot(source, slot)table?

Returns the item definition for the given slot (item base data + slot metadata).

lua
local info = exports['origen_inventory']:GetItemInfoBySlot(source, 1)

GiveWeaponToPlayer(source, weapon, ammo?, metadata?)boolean

Gives a weapon to the player and registers it inside the inventory weapon system.

lua
exports['origen_inventory']:GiveWeaponToPlayer(source, 'weapon_pistol', 30, { serial = 'PD-001' })

Stashes & shops

registerStash(id, data)void

Creates or registers a dynamic stash at runtime.

lua
exports['origen_inventory']:registerStash('faction_locker_1', {
    label = 'Faction Locker',
    slots = 50,
    maxweight = 200000,
})

createShop(id, data)void

Creates a shop at runtime (alias: RegisterShop).

lua
exports['origen_inventory']:createShop('barber_supplies', {
    label = 'Barber Supplies',
    slots = 6,
    items = {
        { name = 'razor', price = 50, amount = 10, metadata = {} },
    },
    locations = { vector3(0.0, 0.0, 70.0) },
})

customDrop(coords, items, model?)string

Creates a custom ground drop and returns its id.

lua
local dropId = exports['origen_inventory']:customDrop(
    vector3(123.4, 567.8, 21.0),
    { { name = 'tosti', amount = 1, info = {} } }
)

Custom items

The custom items API is documented in the Custom page.

AddCustomItem(data)void

Registers a new custom item in the database.

lua
exports.origen_inventory:AddCustomItem({
    name = 'origen_compass',
    label = 'Compass',
    weight = 50,
    type = 'item',
    unique = true,
})

EditCustomItem(data)void

Edits an existing custom item.

lua
exports.origen_inventory:EditCustomItem({
    name = 'origen_compass',
    label = 'Magnetic Compass',
    weight = 60,
})

RemoveCustomItem(name)void

Removes a custom item from the database and every active inventory.

lua
exports.origen_inventory:RemoveCustomItem('origen_compass')

Other

notify(source, message, type?, duration?)void

Sends a notification to the player using the configured notify provider.

lua
exports['origen_inventory']:notify(source, 'Item received', 'success', 4000)

registerHook(event, callback, options?)string

Server-side hook registration. See the full reference in Server Hooks.

lua
local hookId = exports.origen_inventory:registerHook('createItem', function(payload)
    return payload.metadata
end)

Client-side exports

Inventory

openInventory(identifier?, data?)void

Opens the player inventory or a secondary inventory on the local client.

lua
exports['origen_inventory']:openInventory()
exports['origen_inventory']:openInventory('stash_personal', { slots = 30, maxweight = 100000 })

getInventory()table

Returns the local player inventory snapshot.

lua
local inv = exports['origen_inventory']:getInventory()

getPlayerItems()table[]

Returns every slot in the local inventory.

lua
local items = exports['origen_inventory']:getPlayerItems()

IsInventoryOpen()boolean

Returns whether the inventory UI is currently open.

lua
local isOpen = exports['origen_inventory']:IsInventoryOpen()

lock() / unlock()void

Locks or unlocks the local inventory. While locked, the player cannot open it.

lua
exports['origen_inventory']:lock()
exports['origen_inventory']:unlock()

isLocked()boolean

Returns whether the local inventory is currently locked.

lua
local locked = exports['origen_inventory']:isLocked()

toggleLock()void

Toggles the lock state.

lua
exports['origen_inventory']:toggleLock()

useSlot(slot)void

Triggers the use action for the given slot on the local client.

lua
exports['origen_inventory']:useSlot(1)

search(target?)void

Initiates a search animation/UI on the target player (or local if omitted).

lua
exports['origen_inventory']:search(GetPlayerServerId(targetPlayer))

getCurrentWeapon()string?

Returns the currently equipped weapon hash, if any.

lua
local weapon = exports['origen_inventory']:getCurrentWeapon()

weaponWheel(toggle)void

Forces the GTA weapon wheel on or off.

lua
exports['origen_inventory']:weaponWheel(false)

hasItem(item, amount?)boolean

Returns whether the local player has the item.

lua
if exports['origen_inventory']:hasItem('phone') then
    -- local player has a phone
end

displayMetadata(slot)void

Triggers the metadata viewer for the given slot.

lua
exports['origen_inventory']:displayMetadata(1)

openManagement()void

Opens the in-game inventory management panel (admins).

lua
exports['origen_inventory']:openManagement()

OnPlayerLoad()void

Manually fires the player-load lifecycle. Required only if you bypass the framework's regular login flow.

lua
exports['origen_inventory']:OnPlayerLoad()

UpdateInventory(items?)void

Forces a UI refresh with the given items (or refetches from server when omitted).

lua
exports['origen_inventory']:UpdateInventory()

CloseInventory()void

Closes the inventory UI.

lua
exports['origen_inventory']:CloseInventory()

Hotbar

ToggleHotBar(toggle)void

Shows or hides the hotbar.

lua
exports['origen_inventory']:ToggleHotBar(true)

Weapons

SetCurrentWeapon(weapon)void

Forces the inventory to mark the given weapon as the active one (sync purposes).

lua
exports['origen_inventory']:SetCurrentWeapon('weapon_pistol')

AddAmmo(weapon, ammo)void

Adds ammo to a weapon and triggers the reload animation.

lua
exports['origen_inventory']:AddAmmo('weapon_pistol', 30)

unarmedPed()void

Removes every weapon from the local ped without affecting the inventory.

lua
exports['origen_inventory']:unarmedPed()

Consumables

Eat(item) / Drink(item) / DrinkAlcohol(item)void

Triggers the corresponding consumable animation and stat change.

lua
exports['origen_inventory']:Eat('tosti')
exports['origen_inventory']:Drink('water_bottle')
exports['origen_inventory']:DrinkAlcohol('beer')

controls()table

Returns the default control config used by consumables (canMove, canSprint, etc.).

lua
local controls = exports['origen_inventory']:controls()

progress_animation_fix(animation)table

Helper that formats an animation block for the progress bar provider currently active.

lua
local anim = exports['origen_inventory']:progress_animation_fix({
    dict = 'mp_player_intdrink',
    clip = 'loop_bottle',
})

World Points

The full world point client API is documented in Custom · World Points.

CreateWorldPoint(id, data)void

Registers a single point.

lua
exports.origen_inventory:CreateWorldPoint('my_lab_table', {
    coords = vector3(123.4, 567.8, 21.0),
    type = 'crafting',
})

RemoveWorldPoint(id)void

Removes a point by id.

lua
exports.origen_inventory:RemoveWorldPoint('my_lab_table')

SetWorldPointEnabled(id, enabled)void

Enables or disables a point.

lua
exports.origen_inventory:SetWorldPointEnabled('my_lab_table', false)

CreateBatchPoints(type, points)void

Registers multiple points at once.

lua
exports.origen_inventory:CreateBatchPoints('crafting', {
    { id = 'lab_a', coords = vector3(0, 0, 70) },
    { id = 'lab_b', coords = vector3(10, 0, 70) },
})

ClearPoints(type)void

Removes every point of a type.

lua
exports.origen_inventory:ClearPoints('crafting')

RefreshAllPoints(type)void

Reloads every point of a type.

lua
exports.origen_inventory:RefreshAllPoints('crafting')

GetPoints(type)table[]

Returns the points of a type.

lua
local points = exports.origen_inventory:GetPoints('crafting')

GetPointCount(type)number

Returns the count of points of a type.

lua
local count = exports.origen_inventory:GetPointCount('crafting')

HasPoint(id)boolean

Returns true if the point exists.

lua
local exists = exports.origen_inventory:HasPoint('my_lab_table')

RegisterPointType(type, config)void

Registers a brand-new point type.

lua
exports.origen_inventory:RegisterPointType('crafting', { distance = 2.0 })

LoadPointType(type)void

Reloads a point type config.

lua
exports.origen_inventory:LoadPointType('crafting')

GetWorldPointManager()table

Returns the underlying manager.

lua
local manager = exports.origen_inventory:GetWorldPointManager()

SetEnabled(id, enabled)void

Backward-compatible alias for shop enable/disable.

lua
exports.origen_inventory:SetEnabled('barber_supplies', true)

SetShopLocalEnabled(id, enabled)void

Toggles a shop on the local client only.

lua
exports.origen_inventory:SetShopLocalEnabled('barber_supplies', false)

Modules (UI panels)

These exports drive secondary UI modules (custom panels you can plug into the inventory tabs).

getModule(id)table?

Returns the data of a registered module.

lua
local mod = exports['origen_inventory']:getModule('my_panel')

getModules()table[]

Returns every registered module.

lua
local modules = exports['origen_inventory']:getModules()

createModule(id, data)void

Registers a new module.

lua
exports['origen_inventory']:createModule('my_panel', {
    label = 'My Panel',
    icon = 'fa-solid fa-gear',
    url = 'nui://my_resource/ui/index.html',
})

removeModule(id)void

Removes a module.

lua
exports['origen_inventory']:removeModule('my_panel')

checkModules()void

Validates the registered modules.

lua
exports['origen_inventory']:checkModules()

sendModuleMessage(id, message)void

Sends a message to a specific module.

lua
exports['origen_inventory']:sendModuleMessage('my_panel', { action = 'refresh' })

Hooks

registerHook(event, callback, options?)string

Client-side hook registration. See Custom · Hooks.

lua
local hookId = exports.origen_inventory:registerHook('useItem', function(payload)
    return true
end)

removeHooks(id)void

Removes a registered hook.

lua
exports.origen_inventory:removeHooks(hookId)

Misc

progressBar(data)boolean

Wraps the active progress bar provider (Config.Progressbar) so any script can play a progress bar consistent with the inventory style.

lua
local ok = exports['origen_inventory']:progressBar({
    label = 'Working...',
    duration = 3000,
})

Carry() / Piggyback()void

Triggers the carry / piggyback action on the player aimed at.

lua
exports['origen_inventory']:Carry()
exports['origen_inventory']:Piggyback()

isCarryInProgress()boolean

Returns true while the local player is carrying or being carried.

lua
local carrying = exports['origen_inventory']:isCarryInProgress()

ToggleDriftMode(toggle)void

Enables or disables the drift handling profile defined in config/drift.lua.

lua
exports['origen_inventory']:ToggleDriftMode(true)

IsItemBlacklisted(item)boolean

Returns whether the item is blacklisted by the inventory rules.

lua
local blocked = exports['origen_inventory']:IsItemBlacklisted('weapon_rpg')

Legacy aliases

For backward compatibility every server-side export above is also exposed in PascalCase, and most have an additional qb-inventory-style name. Examples:

CanonicalLegacy aliases
addItemAddItem
removeItemRemoveItem
getItemGetItem, GetItemByName
getInventoryGetInventory
getItemsgetInventoryItems, GetInventoryItems
setMaxSlotsSetSlotCount
registerStashRegisterStash, InitializeInventory
createShopCreateShop, RegisterShop
getCurrentWeapon (client)GetCurrentWeapon
lock (client)LockInventory
unlock (client)UnlockInventory
isLocked (client)IsInventoryLocked
toggleLock (client)ToggleInventoryAccess
getPlayerItems (client)GetPlayerItems

Always prefer the canonical names in new code. Legacy aliases may be removed in future major versions, and the resource source code already marks some of them as REMOVE ON UPDATE.