🛥️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)exports.origen_inventory:openInventory('shop', 'test')exports.origen_inventory:openInventory('stash', 'my-stash', { 
    label = 'My Stash' 
})
--- Or Simply
exports.origen_inventory:openInventory('stash', 'my-stash')exports.origen_inventory:openInventory('trunk', 'my-stash', { 
    label = 'My Trunk' 
})
--- Or Simply
exports.origen_inventory:openInventory('glovebox', 'my-glove')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:
tableorstringCan be a single item name or array of item names.
metadata?:
tableorstringIf metadata is provided as a string it will search the item's
metadata.typeproperty.
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!')local items = exports.origen_inventory:Search('slots', {'meat', 'skin'}, 'deer')
 
if items then
    for name, data in pairs(items) do
        local count = 0
 
        for _, v in pairs(data) do
            if v.slot then
                print(v.slot..' contains '..v.count..' '..name..' '..json.encode(v.metadata))
                count = count + v.count
            end
        end
 
        print('You have '..count..' '..name.. " Nice!")
    end
endCount
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
endlocal items = exports.origen_inventory:Search('slots', {'meat', 'skin'}, 'deer')
 
if items then
    for name, data in pairs(items) do
        local count = 0
 
        for _, v in pairs(data) do
            if v.slot then
                print(v.slot..' contains '..v.count..' '..name..' '..json.encode(v.metadata))
                count = count + v.count
            end
        end
 
        print('You have '..count..' '..name.. " Nice!")
    end
enduseSlot
---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 numberdisplayMetadata
--- Display item metadata
--- @param metadata table | string
--- @param value any
--- @return boolean
exports.origen_inventory.displayMetadata(metadata, value)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 inventoryToggleHotBar
exports.origen_inventory:ToggleHotBar(visible --[[true/false]])IsInventoryOpen
exports.origen_inventory:IsInventoryOpen() -- return booleanopenInventory
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:
numberorstringdata?:
table
Examples
exports.origen_inventory:openInventory('player', 1)exports.origen_inventory:openInventory('shop', 'test')exports.origen_inventory:openInventory('stash', 'my-stash', { 
    label = 'My Stash' 
})
--- Or Simply
exports.origen_inventory:openInventory('stash', 'my-stash')exports.origen_inventory:openInventory('trunk', 'my-stash', { 
    label = 'My Trunk' 
})
--- Or Simply
exports.origen_inventory:openInventory('trunk', 'my-trunk')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
endGetItems
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]])Modules
sendModuleMessage
Send data to the module for manipulate later
--- Send Module message
--- @param id string
--- @param data any
--- @return boolean
exports.origen_inventory:sendModuleMessage(id, data)
--- Example
exports.origen_inventory:sendModuleMessage('test_tab', {
        action = 'open',
        other = 'blah blah'
})createModule
Create the module including the correct actions to the script need to transform
--- Create Module
--- @param id string
--- @param data any
--- @return boolean
exports.origen_inventory:createModule(id, data)
-- Example
exports.origen_inventory:createModule('test_tab', {
        id = 'test_tab',
        icon = 'lucide:at-sign',
        ui = ("https://cfx-nui-%s/ui/index.html"):format(GetCurrentResourceName()),
        useDefaultBackground = true,
        canShow = function()
                return true
        end,
        onOpen = function() end,
        onClose = function() end
})removeModule
Remove the module
exports.origen_inventory:removeModule('test_tab')Progressbar
Action: exports.origen_inventory:progressBar(...)
exports.origen_inventory:progressBar({
    name = 'custom_action_name', -- Unique name for the action
    duration = 5000, -- Time in milliseconds
    label = 'Performing action...', -- Text to display
    useWhileDead = false, -- Allow use while dead
    controlDisables = {
        disableMovement = true, -- Disable player movement
        disableCarMovement = true, -- Disable vehicle movement
        disableMouse = true, -- Disable mouse input
        disableCombat = true, -- Disable combat actions
    },
    canCancel = true, -- Allow the action to be cancelled
    animation = {
        animDict = 'amb@world_human_hammering@male@base', -- Animation dictionary
        anim = 'base', -- Animation name
        flags = 49, -- Animation flags
    },
    prop = {
        model = 'prop_tool_hammer', -- Prop model
        bone = 28422, -- Bone index to attach the prop
        coords = { x = 0.0, y = 0.0, z = 0.0 }, -- Position offsets
        rotation = { x = 0.0, y = 0.0, z = 0.0 }, -- Rotation offsets
    }
})Last updated