🛥️Client Exports
openInventory
---Lower y upper cases are sensitives
---@param invType string
---@param id string
---@param data? table
exports.origen_inventory:openInventory(invType, id, data?)
invType: string
'player'
'shop'
'stash'
'drop'
'glovebox'
'trunk'
Examples
exports.origen_inventory:openInventory('player', 1)
Search
Searches the inventory for an item, or list of items, result varying based on the first argument.
exports.origen_inventory:Search(search, item, metadata)
search:
'slots'
or'count'
'slots'
returns a table of slots where the item was found at.'count'
returns the count of the specified item in player's inventory. If searching for multiple items returns key-value pairs of itemName = count.
item:
table
orstring
Can be a single item name or array of item names.
metadata?:
table
orstring
If metadata is provided as a string it will search the item's
metadata.type
property.
Slots
local water = exports.origen_inventory:Search('slots', 'water')
local count = 0
for _, v in pairs(water) do
print(v.slot..' contains '..v.count..' water '..json.encode(v.metadata))
count = count + v.count
end
print('You have '..count..' water, Nice!')
Count
local inventory = exports.origen_inventory:Search('count', {'meat', 'skin'}, {grade="1"})
if inventory then
for name, count in pairs(inventory) do
print('You have '..count..' '..name)
end
end
useSlot
---Use Inventory Slot
---@param slot number
---@return boolean
exports.origen_inventory:useSlot(slot)
-- Returns false if slot its not a number
-- Returns true if slot is number
Deprecated Exports
These exports continue to function as long as they are on this list, please prioritize replacing with new exports.
Support for these exports is a lower priority, you can request new exports on our support discord.
OnPlayerLoad
Force the player's boot and inventory systems.
exports.origen_inventory:OnPlayerLoad()
Lock/Unlock Inventory
exports.origen_inventory:IsInventoryLocked() -- return boolean
exports.origen_inventory:LockInventory() -- return void
exports.origen_inventory:UnlockInventory() -- return void
exports.origen_inventory:ToggleInventoryAccess(lock --[[true/false]]) -- Lock / unlock inventory
ToggleHotBar
exports.origen_inventory:ToggleHotBar(visible --[[true/false]])
IsInventoryOpen
exports.origen_inventory:IsInventoryOpen() -- return boolean
openInventory
Open a giving inventory
--- Lower y upper cases are sensitives (openInventory not equal to old OpenInventory exports)
exports.origen_inventory:openInventory(invType, id, data?)
invType:
string
'player'
'shop'
'stash'
'drop'
'glovebox'
'trunk'
id:
number
orstring
data?:
table
Examples
exports.origen_inventory:openInventory('player', 1)
GetInventory
Get Player inventory data
-- return table of items list
-- The following exports do exactly the same thing, for compatibility between various scripts.
exports.origen_inventory:GetInventory()
exports.origen_inventory:getPlayerInventory()
exports.origen_inventory:GetPlayerInventory()
--- Example
local myItems = exports.origen_inventory:GetInventory()
for slot, item in pairs(myItems) do
if item.name == 'id_card' then
...
end
end
CloseInventory
Close player inventory
exports.origen_inventory:CloseInventory()
HasItem
Check if player has item
-- @return boolean
exports.origen_inventory:HasItem(item_name)
-- Example use
local hasWater --[[true/false]] = exports.origen_inventory:HasItem("water")
if hasWater then
-- Do something
end
GetItems
Return the server item list or specific one
exports.origen_inventory:Items(item?)
exports.origen_inventory:GetInventoryItem(item?)
exports.origen_inventory:GetItemList(item?)
exports.origen_inventory:GetItems(item?)
exports.origen_inventory:getItems(item?)
Unarmed
Set player unarmed
exports.origen_inventory:Unarmed()
SetCurrentWeapon
exports.origen_inventory:SetCurrentWeapon(weapon_data, can_shoot)
-- Example usage
exports.origen_inventory:SetCurrentWeapon({
name = "WEAPON_PISTOL"
info = {
attachments = {
{
component = "COMPONENT_PISTOL_CLIP_02" -- Component Hash or Name
}
},
tint = 1
}
}, true)
SetCurrentWeapon
exports.origen_inventory:AddAmmo(type, amount, item)
SetShopEnabled
exports.origen_inventory:SetShopEnabled(shopId, enabled --[[true/false]])
Others
For either one, it will look for the closest player to execute the action.
Carry a near player
exports.origen_inventory:Carry()
PiggyBack near player
exports.origen_inventory:PiggyBack()
ToggleDriftMode
If driftmode is enabled you can toggle it with export
exports.origen_inventory:ToggleDriftMode(toggle--[[true/false]])
Last updated