Server

🟡 Server Exports

RegisterStash

exports.origen_inventory:RegisterStash(stash_name, stash_data)

-- Example usage
exports.origen_inventory:RegisterStash('police_locker', {
    label = "Police Locker",
    slots = 10,
    weight = 100
})

CanCarryItem

exports.origen_inventory:CanCarryItem(playerId, item, amount)

GetStash

exports.origen_inventory:GetStash(stash_name)

GetStashItems

exports.origen_inventory:GetStashItems(stash_name)

StashGetItemByname

exports.origen_inventory:StashGetItemByname(stash_name, item_name)

CanCarryItem

exports.origen_inventory:CanCarryItems(playerId, item, amount)

GiveWeaponToPlayer

exports.origen_inventory:GiveWeaponToPlayer(playerId, weapon_name, ammo)

ClearInventory

exports.origen_inventory:ClearInventory(playerId, filter)

SetInventory

exports.origen_inventory:SetInventory(playerId, inventory)

SetInventoryItems

exports.origen_inventory:SetInventoryItems(playerId, item, amount)

GetTotalWeight

exports.origen_inventory:GetTotalWeight(playerId)

HasItem

exports.origen_inventory:HasItem(playerId, item, amount)

GetItemByName

exports.origen_inventory:GetItemByName(playerId, item)

GetSlotsByItem

exports.origen_inventory:GetSlotsByItem(items, item)

GetItemByslot

exports.origen_inventory:GetItemBySlot(playerId, slot)

GetFirstSlotByItem

exports.origen_inventory:GetFirstSlotByItem(items, item)

GetItemTotalAmount

exports.origen_inventory:GetItemTotalAmount(playerId, item)

RemoveItem

exports.origen_inventory:RemoveItem(inventory, item, amount)

AddItem

exports.origen_inventory:AddItem(inventory, item, amount, slot --[[optional]],  metadata--[[optional]], ignoreWeight --[[optional]])

Example

exports.origen_inventory:AddItem(1, 'tosti', 1) -- Give x1 tosti to player 1
exports.origen_inventory:AddItem('test', 'tosti', 1) -- Give x1 tosti to stash test
exports.origen_inventory:AddItem('trunk_test', 'tosti', 1) -- Give x1 tosti to stash test

SetItemMetada

exports.origen_inventory:SetItemMetadata(playerId, item, slot, metadata)

AddItemMetadata

exports.origen_inventory:AddItemMetadata(playerId, item, slot, metadata)

SetInventoryData

exports.origen_inventory:SetInventoryData(fromInventory, toInventory, fromSlot, toSlot, fromAmount, toAmount)

OpenInventory

--[[
    Inventory Types:
    - playerId
    - otherplayer
    - stash
    - trunk
    - glovebox
    - drop
    - shop
]]
exports.origen_inventory:OpenInventory(playerId, inventory_type, inventory_id)

-- Example
exports.origen_inventory:OpenInventory(1, 'stash', 'police-locker')

GetItemLabel

exports.origen_inventory:GetItemLabel(item)

SaveInventory

exports.origen_inventory:SaveInventory(playerId, isOffline?)

LoadInventory

-- Note: firstLoading represents whether the inventory should be loaded from the database (true) or from the cache (false).
exports.origen_inventory:LoadInventory(playerId, firstLoading?)

GetPlayerInventory

exports.origen_inventory:getPlayerInventory(playerId)

GetInventory

exports.origen_inventory:GetInventory(invType, id) -- Search specific inventory
exports.origen_inventory:GetInventory(id) -- Search all stashes and get the first match

InvTypes:

  • 'player'

  • 'stash'

  • 'trunk'

  • 'glovebox'

GetUsableItem

exports.origen_inventory:GetUsableItem(name)

CreateUseableItem

exports.origen_inventory:CreateUseableItem(name, cb)

UseItem

exports.origen_inventory:UseItem(playerId, name)

UseItemSlot

exports.origen_inventory:UseItemSlot(slot, inventory_id)

GetTotalWeightByItems

local items = { 'id_card', 'sandwich' }
exports.origen_inventory:GetTotalWeightByItems(items)

OpenInventoryById

exports.origen_inventory:OpenInventoryById(playerId, otherPlayerId)

GetItemByMetadata

exports.origen_inventory:GetItemByMetadata(playerId, metaKey, metaValue)

GetItemsByMetadata

exports.origen_inventory:GetItemsByMetadata(playerId, metaKey, metaValue)

GetItemByMetaKey

exports.origen_inventory:GetItemByMetaKey(playerId, metaKey)

GetItemsByMetaKey

exports.origen_inventory:GetItemsByMetaKey(playerId, metaKey)

GetItemInfoBySlot

exports.origen_inventory:GetItemInfoBySlot(playerId, itemName, slot)

GetItemCount

exports.origen_inventory:GetItemCount(playerId, itemName, metadata, strict)

GetItem

exports.origen_inventory:GetItem(playerId, itemName, metadata, returnsCount)

Last updated