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.
Server-side exports
Items
addItem(source, item, amount, slot?, info?) → boolean
Adds an item to the player inventory. Returns true on success.
exports['origen_inventory']:addItem(source, 'tosti', 1, nil, { quality = 100 })addItems(source, items) → boolean
Adds multiple items at once.
exports['origen_inventory']:addItems(source, {
{ item = 'tosti', amount = 2 },
{ item = 'water_bottle', amount = 1 },
})removeItem(source, item, amount, slot?) → boolean
Removes an item.
exports['origen_inventory']:removeItem(source, 'tosti', 1)removeItems(source, items) → boolean
Removes 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?) → boolean
Sets the item amount in a slot, replacing the previous value.
exports['origen_inventory']:setItem(source, 'water_bottle', 5, 3)canCarryItem(source, item, amount) → boolean
Returns true if the player can carry the given amount.
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.
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.
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) → boolean
Merges metadata into an existing slot.
exports['origen_inventory']:addItemMetadata(source, 'phone', 1, { battery = 80 })removeItemMetadata(source, item, slot, keys) → boolean
Removes one or more metadata keys from a slot.
exports['origen_inventory']:removeItemMetadata(source, 'phone', 1, { 'battery' })setMetadata(source, slot, metadata) → boolean
Replaces the slot metadata entirely.
exports['origen_inventory']:setMetadata(source, 1, { quality = 100, serial = 'XYZ-123' })setUses(source, slot, uses) → boolean
Sets the remaining uses for a slot.
exports['origen_inventory']:setUses(source, 1, 3)getItemLabel(item) → string
Returns the display label of an item.
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.).
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) → boolean
Replaces the contents of the given inventory.
exports['origen_inventory']:setInventory('faction_locker_1', {
{ slot = 1, name = 'tosti', amount = 5, info = {} },
})clearInventory(identifier) → boolean
Empties an inventory.
exports['origen_inventory']:clearInventory('faction_locker_1')setMaxWeight(identifier, weight) → boolean
Sets the maximum weight of the given inventory.
exports['origen_inventory']:setMaxWeight('faction_locker_1', 200000)setMaxSlots(identifier, slots) → boolean
Sets the maximum slot count of the given inventory.
exports['origen_inventory']:setMaxSlots('faction_locker_1', 50)saveInventory(identifier) → boolean
Forces a save of the inventory state to the database.
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.
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.
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.
exports['origen_inventory']:OpenInventoryById(source, 'evidence_locker_42')LoadInventory(source) → void
Reloads the player inventory from the database.
exports['origen_inventory']:LoadInventory(source)GetPlayerInventory(source) → table
Returns the entire player inventory snapshot (all slots).
local inv = exports['origen_inventory']:GetPlayerInventory(source)SetInventoryItems(source, items) → boolean
Bulk-replaces every slot in the player inventory.
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.
exports['origen_inventory']:SetInventoryData(source, { items = {}, weight = 0 })GetTotalWeight(source) → number
Returns the current total weight.
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.
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) → number
Returns 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?) → boolean
Gives a weapon to the player and registers it inside the inventory weapon system.
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.
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).
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.
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.
exports.origen_inventory:AddCustomItem({
name = 'origen_compass',
label = 'Compass',
weight = 50,
type = 'item',
unique = true,
})EditCustomItem(data) → void
Edits an existing custom item.
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.
exports.origen_inventory:RemoveCustomItem('origen_compass')Other
notify(source, message, type?, duration?) → void
Sends a notification to the player using the configured notify provider.
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.
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.
exports['origen_inventory']:openInventory()
exports['origen_inventory']:openInventory('stash_personal', { slots = 30, maxweight = 100000 })getInventory() → table
Returns 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() → boolean
Returns whether the inventory UI is currently open.
local isOpen = exports['origen_inventory']:IsInventoryOpen()lock() / unlock() → void
Locks or unlocks the local inventory. While locked, the player cannot open it.
exports['origen_inventory']:lock()
exports['origen_inventory']:unlock()isLocked() → boolean
Returns whether the local inventory is currently locked.
local locked = exports['origen_inventory']:isLocked()toggleLock() → void
Toggles the lock state.
exports['origen_inventory']:toggleLock()useSlot(slot) → void
Triggers the use action for the given slot on the local client.
exports['origen_inventory']:useSlot(1)search(target?) → void
Initiates 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) → void
Forces the GTA weapon wheel on or off.
exports['origen_inventory']:weaponWheel(false)hasItem(item, amount?) → boolean
Returns whether the local player has the item.
if exports['origen_inventory']:hasItem('phone') then
-- local player has a phone
enddisplayMetadata(slot) → void
Triggers the metadata viewer for the given slot.
exports['origen_inventory']:displayMetadata(1)openManagement() → void
Opens the in-game inventory management panel (admins).
exports['origen_inventory']:openManagement()OnPlayerLoad() → void
Manually fires the player-load lifecycle. Required only if you bypass the framework's regular login flow.
exports['origen_inventory']:OnPlayerLoad()UpdateInventory(items?) → void
Forces a UI refresh with the given items (or refetches from server when omitted).
exports['origen_inventory']:UpdateInventory()CloseInventory() → void
Closes the inventory UI.
exports['origen_inventory']:CloseInventory()Hotbar
ToggleHotBar(toggle) → void
Shows or hides the hotbar.
exports['origen_inventory']:ToggleHotBar(true)Weapons
SetCurrentWeapon(weapon) → void
Forces the inventory to mark the given weapon as the active one (sync purposes).
exports['origen_inventory']:SetCurrentWeapon('weapon_pistol')AddAmmo(weapon, ammo) → void
Adds ammo to a weapon and triggers the reload animation.
exports['origen_inventory']:AddAmmo('weapon_pistol', 30)unarmedPed() → void
Removes every weapon from the local ped without affecting the inventory.
exports['origen_inventory']:unarmedPed()Consumables
Eat(item) / Drink(item) / DrinkAlcohol(item) → void
Triggers the corresponding consumable animation and stat change.
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.).
local controls = exports['origen_inventory']:controls()progress_animation_fix(animation) → table
Helper 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',
})World Points
The full world point client API is documented in Custom · World Points.
CreateWorldPoint(id, data) → void
Registers a single point.
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.
exports.origen_inventory:RemoveWorldPoint('my_lab_table')SetWorldPointEnabled(id, enabled) → void
Enables or disables a point.
exports.origen_inventory:SetWorldPointEnabled('my_lab_table', false)CreateBatchPoints(type, points) → void
Registers 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) → void
Removes every point of a type.
exports.origen_inventory:ClearPoints('crafting')RefreshAllPoints(type) → void
Reloads 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) → number
Returns the count of points of a type.
local count = exports.origen_inventory:GetPointCount('crafting')HasPoint(id) → boolean
Returns true if the point exists.
local exists = exports.origen_inventory:HasPoint('my_lab_table')RegisterPointType(type, config) → void
Registers a brand-new point type.
exports.origen_inventory:RegisterPointType('crafting', { distance = 2.0 })LoadPointType(type) → void
Reloads a point type config.
exports.origen_inventory:LoadPointType('crafting')GetWorldPointManager() → table
Returns the underlying manager.
local manager = exports.origen_inventory:GetWorldPointManager()SetEnabled(id, enabled) → void
Backward-compatible alias for shop enable/disable.
exports.origen_inventory:SetEnabled('barber_supplies', true)SetShopLocalEnabled(id, enabled) → void
Toggles a shop on the local client only.
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.
local mod = exports['origen_inventory']:getModule('my_panel')getModules() → table[]
Returns every registered module.
local modules = exports['origen_inventory']:getModules()createModule(id, data) → void
Registers 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) → void
Removes a module.
exports['origen_inventory']:removeModule('my_panel')checkModules() → void
Validates the registered modules.
exports['origen_inventory']:checkModules()sendModuleMessage(id, message) → void
Sends a message to a specific module.
exports['origen_inventory']:sendModuleMessage('my_panel', { action = 'refresh' })Hooks
registerHook(event, callback, options?) → string
Client-side hook registration. See Custom · Hooks.
local hookId = exports.origen_inventory:registerHook('useItem', function(payload)
return true
end)removeHooks(id) → void
Removes a registered hook.
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.
local ok = exports['origen_inventory']:progressBar({
label = 'Working...',
duration = 3000,
})Carry() / Piggyback() → void
Triggers the carry / piggyback action on the player aimed at.
exports['origen_inventory']:Carry()
exports['origen_inventory']:Piggyback()isCarryInProgress() → boolean
Returns true while the local player is carrying or being carried.
local carrying = exports['origen_inventory']:isCarryInProgress()ToggleDriftMode(toggle) → void
Enables or disables the drift handling profile defined in config/drift.lua.
exports['origen_inventory']:ToggleDriftMode(true)IsItemBlacklisted(item) → boolean
Returns whether the item is blacklisted by the inventory rules.
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:
| 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.