Home › Documentation › 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. addItem ⇄ AddItem, getInventory ⇄ GetInventory) kept for backward compatibility with scripts that targeted older versions or qb-inventory / ox_inventory.
addItem(source, item, amount, slot?, info?) → booleanAdds an item to the player inventory. Returns true on success.
exports['origen_inventory']:addItem(source, 'tosti', 1, nil, { quality = 100 })addItems(source, items) → booleanAdds multiple items at once.
exports['origen_inventory']:addItems(source, {
{ item = 'tosti', amount = 2 },
{ item = 'water_bottle', amount = 1 },
})removeItem(source, item, amount, slot?) → booleanRemoves an item.
exports['origen_inventory']:removeItem(source, 'tosti', 1)removeItems(source, items) → booleanRemoves multiple items at once. Same payload shape as addItems.
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).
local slot = exports['origen_inventory']:getItem(source, 'phone')setItem(source, item, amount, slot?, info?) → booleanSets the item amount in a slot, replacing the previous value.
exports['origen_inventory']:setItem(source, 'water_bottle', 5, 3)canCarryItem(source, item, amount) → booleanReturns true if the player can carry the given amount.
local canCarry = exports['origen_inventory']:canCarryItem(source, 'tosti', 5)canSwapItem(source, fromItem, fromAmount, toItem, toAmount) → booleanChecks whether the player can swap fromItem for toItem.
local canSwap = exports['origen_inventory']:canSwapItem(source, 'tosti', 1, 'water_bottle', 1)getItemCount(source, item) → numberReturns the total amount of an item in the player inventory.
local count = exports['origen_inventory']:getItemCount(source, 'tosti')getSlot(source, slot) → table?Returns the data of the specified slot.
local slot = exports['origen_inventory']:getSlot(source, 1)getSlotsIdWithItem(source, item) → number[]Returns every slot id holding the given item.
local slots = exports['origen_inventory']:getSlotsIdWithItem(source, 'tosti')getSlotWithItem(source, item) → table?Returns the first slot data holding the given item.
local slot = exports['origen_inventory']:getSlotWithItem(source, 'phone')addItemMetadata(source, item, slot, metadata) → booleanMerges metadata into an existing slot.
exports['origen_inventory']:addItemMetadata(source, 'phone', 1, { battery = 80 })removeItemMetadata(source, item, slot, keys) → booleanRemoves one or more metadata keys from a slot.
exports['origen_inventory']:removeItemMetadata(source, 'phone', 1, { 'battery' })setMetadata(source, slot, metadata) → booleanReplaces the slot metadata entirely.
exports['origen_inventory']:setMetadata(source, 1, { quality = 100, serial = 'XYZ-123' })setUses(source, slot, uses) → booleanSets the remaining uses for a slot.
exports['origen_inventory']:setUses(source, 1, 3)getItemLabel(item) → stringReturns the display label of an item.
local label = exports['origen_inventory']:getItemLabel('tosti')getInventory(identifier) → table?Returns the inventory data for a given identifier (player id, stash id, plate, etc.).
local inv = exports['origen_inventory']:getInventory('faction_locker_1')getItems(identifier) → table[]Returns every item slot in the given inventory.
local items = exports['origen_inventory']:getItems('faction_locker_1')setInventory(identifier, items) → booleanReplaces the contents of the given inventory.
exports['origen_inventory']:setInventory('faction_locker_1', {
{ slot = 1, name = 'tosti', amount = 5, info = {} },
})clearInventory(identifier) → booleanEmpties an inventory.
exports['origen_inventory']:clearInventory('faction_locker_1')setMaxWeight(identifier, weight) → booleanSets the maximum weight of the given inventory.
exports['origen_inventory']:setMaxWeight('faction_locker_1', 200000)setMaxSlots(identifier, slots) → booleanSets the maximum slot count of the given inventory.
exports['origen_inventory']:setMaxSlots('faction_locker_1', 50)saveInventory(identifier) → booleanForces a save of the inventory state to the database.
exports['origen_inventory']:saveInventory('faction_locker_1')useSlot(source, slot) → voidTriggers the use action for the given slot, identical to the player clicking on it.
exports['origen_inventory']:useSlot(source, 1)These exports are convenience wrappers around the player inventory.
OpenInventory(source, identifier?, data?) → voidOpens an inventory on the client. When identifier is nil opens the player inventory; otherwise opens the matching stash, trunk or glovebox.
exports['origen_inventory']:OpenInventory(source) -- player inventory
exports['origen_inventory']:OpenInventory(source, 'evidence_locker', { slots = 50, maxweight = 200000 })OpenInventoryById(source, identifier, data?) → voidOpens an arbitrary inventory by id. Useful for evidence lockers, faction stashes, etc.
exports['origen_inventory']:OpenInventoryById(source, 'evidence_locker_42')LoadInventory(source) → voidReloads the player inventory from the database.
exports['origen_inventory']:LoadInventory(source)GetPlayerInventory(source) → tableReturns the entire player inventory snapshot (all slots).
local inv = exports['origen_inventory']:GetPlayerInventory(source)SetInventoryItems(source, items) → booleanBulk-replaces every slot in the player inventory.
exports['origen_inventory']:SetInventoryItems(source, {
{ slot = 1, name = 'tosti', amount = 1, info = {} },
})SetInventoryData(source, data) → booleanReplaces the entire data envelope (items + metadata) of the player inventory.
exports['origen_inventory']:SetInventoryData(source, { items = {}, weight = 0 })GetTotalWeight(source) → numberReturns the current total weight.
local weight = exports['origen_inventory']:GetTotalWeight(source)HasItem(source, item, amount?) → booleanReturns whether the player has at least amount (default 1) of the item.
if exports['origen_inventory']:HasItem(source, 'phone') then
-- player has a phone
endGetItemsByName(source, item) → table[]Returns every slot occupied by the given item.
local slots = exports['origen_inventory']:GetItemsByName(source, 'tosti')GetSlotsByItem(source, item) → number[]Returns the slot ids occupied by the given item.
local slotIds = exports['origen_inventory']:GetSlotsByItem(source, 'tosti')GetItemBySlot(source, slot) → table?Returns the item in a given slot.
local item = exports['origen_inventory']:GetItemBySlot(source, 1)GetFirstSlotByItem(source, item) → number?Returns the first slot id holding the item.
local slotId = exports['origen_inventory']:GetFirstSlotByItem(source, 'phone')GetItemTotalAmount(source, item) → numberReturns the total amount of the item.
local total = exports['origen_inventory']:GetItemTotalAmount(source, 'tosti')GetItemByMetadata(source, item, key, value) → table?Returns the first slot whose metadata key equals value.
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.
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.
local slot = exports['origen_inventory']:GetItemByMetaKey(source, 'phone', 'serial')GetItemsByMetaKey(source, item, key) → table[]Returns every slot whose metadata contains the given key.
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).
local info = exports['origen_inventory']:GetItemInfoBySlot(source, 1)GiveWeaponToPlayer(source, weapon, ammo?, metadata?) → booleanGives a weapon to the player and registers it inside the inventory weapon system.
exports['origen_inventory']:GiveWeaponToPlayer(source, 'weapon_pistol', 30, { serial = 'PD-001' })registerStash(id, data) → voidCreates or registers a dynamic stash at runtime.
exports['origen_inventory']:registerStash('faction_locker_1', {
label = 'Faction Locker',
slots = 50,
maxweight = 200000,
})createShop(id, data) → voidCreates a shop at runtime (alias: RegisterShop).
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?) → stringCreates a custom ground drop and returns its id.
local dropId = exports['origen_inventory']:customDrop(
vector3(123.4, 567.8, 21.0),
{ { name = 'tosti', amount = 1, info = {} } }
)The custom items API is documented in the Custom page.
AddCustomItem(data) → voidRegisters a new custom item in the database.
exports.origen_inventory:AddCustomItem({
name = 'origen_compass',
label = 'Compass',
weight = 50,
type = 'item',
unique = true,
})EditCustomItem(data) → voidEdits an existing custom item.
exports.origen_inventory:EditCustomItem({
name = 'origen_compass',
label = 'Magnetic Compass',
weight = 60,
})RemoveCustomItem(name) → voidRemoves a custom item from the database and every active inventory.
exports.origen_inventory:RemoveCustomItem('origen_compass')notify(source, message, type?, duration?) → voidSends a notification to the player using the configured notify provider.
exports['origen_inventory']:notify(source, 'Item received', 'success', 4000)registerHook(event, callback, options?) → stringServer-side hook registration. See the full reference in Server Hooks.
local hookId = exports.origen_inventory:registerHook('createItem', function(payload)
return payload.metadata
end)openInventory(identifier?, data?) → voidOpens the player inventory or a secondary inventory on the local client.
exports['origen_inventory']:openInventory()
exports['origen_inventory']:openInventory('stash_personal', { slots = 30, maxweight = 100000 })getInventory() → tableReturns the local player inventory snapshot.
local inv = exports['origen_inventory']:getInventory()getPlayerItems() → table[]Returns every slot in the local inventory.
local items = exports['origen_inventory']:getPlayerItems()IsInventoryOpen() → booleanReturns whether the inventory UI is currently open.
local isOpen = exports['origen_inventory']:IsInventoryOpen()lock() / unlock() → voidLocks or unlocks the local inventory. While locked, the player cannot open it.
exports['origen_inventory']:lock()
exports['origen_inventory']:unlock()isLocked() → booleanReturns whether the local inventory is currently locked.
local locked = exports['origen_inventory']:isLocked()toggleLock() → voidToggles the lock state.
exports['origen_inventory']:toggleLock()useSlot(slot) → voidTriggers the use action for the given slot on the local client.
exports['origen_inventory']:useSlot(1)search(target?) → voidInitiates a search animation/UI on the target player (or local if omitted).
exports['origen_inventory']:search(GetPlayerServerId(targetPlayer))getCurrentWeapon() → string?Returns the currently equipped weapon hash, if any.
local weapon = exports['origen_inventory']:getCurrentWeapon()weaponWheel(toggle) → voidForces the GTA weapon wheel on or off.
exports['origen_inventory']:weaponWheel(false)hasItem(item, amount?) → booleanReturns whether the local player has the item.
if exports['origen_inventory']:hasItem('phone') then
-- local player has a phone
enddisplayMetadata(slot) → voidTriggers the metadata viewer for the given slot.
exports['origen_inventory']:displayMetadata(1)openManagement() → voidOpens the in-game inventory management panel (admins).
exports['origen_inventory']:openManagement()OnPlayerLoad() → voidManually fires the player-load lifecycle. Required only if you bypass the framework's regular login flow.
exports['origen_inventory']:OnPlayerLoad()UpdateInventory(items?) → voidForces a UI refresh with the given items (or refetches from server when omitted).
exports['origen_inventory']:UpdateInventory()CloseInventory() → voidCloses the inventory UI.
exports['origen_inventory']:CloseInventory()ToggleHotBar(toggle) → voidShows or hides the hotbar.
exports['origen_inventory']:ToggleHotBar(true)SetCurrentWeapon(weapon) → voidForces the inventory to mark the given weapon as the active one (sync purposes).
exports['origen_inventory']:SetCurrentWeapon('weapon_pistol')AddAmmo(weapon, ammo) → voidAdds ammo to a weapon and triggers the reload animation.
exports['origen_inventory']:AddAmmo('weapon_pistol', 30)unarmedPed() → voidRemoves every weapon from the local ped without affecting the inventory.
exports['origen_inventory']:unarmedPed()Eat(item) / Drink(item) / DrinkAlcohol(item) → voidTriggers the corresponding consumable animation and stat change.
exports['origen_inventory']:Eat('tosti')
exports['origen_inventory']:Drink('water_bottle')
exports['origen_inventory']:DrinkAlcohol('beer')controls() → tableReturns the default control config used by consumables (canMove, canSprint, etc.).
local controls = exports['origen_inventory']:controls()progress_animation_fix(animation) → tableHelper that formats an animation block for the progress bar provider currently active.
local anim = exports['origen_inventory']:progress_animation_fix({
dict = 'mp_player_intdrink',
clip = 'loop_bottle',
})The full world point client API is documented in Custom · World Points.
CreateWorldPoint(id, data) → voidRegisters a single point.
exports.origen_inventory:CreateWorldPoint('my_lab_table', {
coords = vector3(123.4, 567.8, 21.0),
type = 'crafting',
})RemoveWorldPoint(id) → voidRemoves a point by id.
exports.origen_inventory:RemoveWorldPoint('my_lab_table')SetWorldPointEnabled(id, enabled) → voidEnables or disables a point.
exports.origen_inventory:SetWorldPointEnabled('my_lab_table', false)CreateBatchPoints(type, points) → voidRegisters multiple points at once.
exports.origen_inventory:CreateBatchPoints('crafting', {
{ id = 'lab_a', coords = vector3(0, 0, 70) },
{ id = 'lab_b', coords = vector3(10, 0, 70) },
})ClearPoints(type) → voidRemoves every point of a type.
exports.origen_inventory:ClearPoints('crafting')RefreshAllPoints(type) → voidReloads every point of a type.
exports.origen_inventory:RefreshAllPoints('crafting')GetPoints(type) → table[]Returns the points of a type.
local points = exports.origen_inventory:GetPoints('crafting')GetPointCount(type) → numberReturns the count of points of a type.
local count = exports.origen_inventory:GetPointCount('crafting')HasPoint(id) → booleanReturns true if the point exists.
local exists = exports.origen_inventory:HasPoint('my_lab_table')RegisterPointType(type, config) → voidRegisters a brand-new point type.
exports.origen_inventory:RegisterPointType('crafting', { distance = 2.0 })LoadPointType(type) → voidReloads a point type config.
exports.origen_inventory:LoadPointType('crafting')GetWorldPointManager() → tableReturns the underlying manager.
local manager = exports.origen_inventory:GetWorldPointManager()SetEnabled(id, enabled) → voidBackward-compatible alias for shop enable/disable.
exports.origen_inventory:SetEnabled('barber_supplies', true)SetShopLocalEnabled(id, enabled) → voidToggles a shop on the local client only.
exports.origen_inventory:SetShopLocalEnabled('barber_supplies', false)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.
local mod = exports['origen_inventory']:getModule('my_panel')getModules() → table[]Returns every registered module.
local modules = exports['origen_inventory']:getModules()createModule(id, data) → voidRegisters a new module.
exports['origen_inventory']:createModule('my_panel', {
label = 'My Panel',
icon = 'fa-solid fa-gear',
url = 'nui://my_resource/ui/index.html',
})removeModule(id) → voidRemoves a module.
exports['origen_inventory']:removeModule('my_panel')checkModules() → voidValidates the registered modules.
exports['origen_inventory']:checkModules()sendModuleMessage(id, message) → voidSends a message to a specific module.
exports['origen_inventory']:sendModuleMessage('my_panel', { action = 'refresh' })registerHook(event, callback, options?) → stringClient-side hook registration. See Custom · Hooks.
local hookId = exports.origen_inventory:registerHook('useItem', function(payload)
return true
end)removeHooks(id) → voidRemoves a registered hook.
exports.origen_inventory:removeHooks(hookId)progressBar(data) → booleanWraps the active progress bar provider (Config.Progressbar) so any script can play a progress bar consistent with the inventory style.
local ok = exports['origen_inventory']:progressBar({
label = 'Working...',
duration = 3000,
})Carry() / Piggyback() → voidTriggers the carry / piggyback action on the player aimed at.
exports['origen_inventory']:Carry()
exports['origen_inventory']:Piggyback()isCarryInProgress() → booleanReturns true while the local player is carrying or being carried.
local carrying = exports['origen_inventory']:isCarryInProgress()ToggleDriftMode(toggle) → voidEnables or disables the drift handling profile defined in config/drift.lua.
exports['origen_inventory']:ToggleDriftMode(true)IsItemBlacklisted(item) → booleanReturns whether the item is blacklisted by the inventory rules.
local blocked = exports['origen_inventory']:IsItemBlacklisted('weapon_rpg')For backward compatibility every server-side export above is also exposed in PascalCase, and most have an additional qb-inventory-style name. Examples:
| Canonical | Legacy aliases |
|---|---|
addItem | AddItem |
removeItem | RemoveItem |
getItem | GetItem, GetItemByName |
getInventory | GetInventory |
getItems | getInventoryItems, GetInventoryItems |
setMaxSlots | SetSlotCount |
registerStash | RegisterStash, InitializeInventory |
createShop | CreateShop, 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.