🟡 Server Exports
RegisterStash
Copy exports.origen_inventory: RegisterStash (stash_name, stash_data)
-- Example usage
exports.origen_inventory: RegisterStash ( 'police_locker' , {
label = "Police Locker" ,
slots = 10 ,
weight = 100
})
CanCarryItem
Copy exports.origen_inventory: CanCarryItem (playerId, item, amount)
GetStash
Copy exports.origen_inventory: GetStash (stash_name)
GetStashItems
Copy exports.origen_inventory: GetStashItems (stash_name)
StashGetItemByname
Copy exports.origen_inventory: StashGetItemByname (stash_name, item_name)
CanCarryItem
Copy exports.origen_inventory: CanCarryItems (playerId, item, amount)
GiveWeaponToPlayer
Copy exports.origen_inventory: GiveWeaponToPlayer (playerId, weapon_name, ammo)
ClearInventory
Copy exports.origen_inventory: ClearInventory (playerId, filter)
SetInventory
Copy exports.origen_inventory: SetInventory (playerId, inventory)
SetInventoryItems
Copy exports.origen_inventory: SetInventoryItems (playerId, item, amount)
GetTotalWeight
Copy exports.origen_inventory: GetTotalWeight (playerId)
HasItem
Copy exports.origen_inventory: HasItem (playerId, item, amount)
GetItemByName
Copy exports.origen_inventory: GetItemByName (playerId, item)
GetSlotsByItem
Copy exports.origen_inventory: GetSlotsByItem (items, item)
GetItemByslot
Copy exports.origen_inventory: GetItemBySlot (playerId, slot)
GetFirstSlotByItem
Copy exports.origen_inventory: GetFirstSlotByItem (items, item)
GetItemTotalAmount
Copy exports.origen_inventory: GetItemTotalAmount (playerId, item)
RemoveItem
Copy exports.origen_inventory: RemoveItem (inventory, item, amount)
AddItem
Copy exports.origen_inventory:AddItem(inventory, item, amount, slot --[[optional]], metadata--[[optional]], ignoreWeight --[[optional]])
Example
Copy 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
Copy exports.origen_inventory: SetItemMetadata (playerId, item, slot, metadata)
AddItemMetadata
Copy exports.origen_inventory: AddItemMetadata (playerId, item, slot, metadata)
SetInventoryData
Copy exports.origen_inventory: SetInventoryData (fromInventory, toInventory, fromSlot, toSlot, fromAmount, toAmount)
OpenInventory
Copy --[[
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
Copy exports.origen_inventory: GetItemLabel (item)
SaveInventory
Copy exports.origen_inventory: SaveInventory (playerId, isOffline?)
LoadInventory
Copy -- 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
Copy exports.origen_inventory: getPlayerInventory (playerId)
GetInventory
Copy exports.origen_inventory: GetInventory (invType, id) -- Search specific inventory
exports.origen_inventory: GetInventory (id) -- Search all stashes and get the first match
InvTypes:
GetUsableItem
Copy exports.origen_inventory: GetUsableItem (name)
CreateUseableItem
Copy exports.origen_inventory: CreateUseableItem (name, cb)
UseItem
Copy exports.origen_inventory: UseItem (playerId, name)
UseItemSlot
Copy exports.origen_inventory: UseItemSlot (slot, inventory_id)
GetTotalWeightByItems
Copy local items = { 'id_card' , 'sandwich' }
exports.origen_inventory: GetTotalWeightByItems (items)
OpenInventoryById
Copy exports.origen_inventory: OpenInventoryById (playerId, otherPlayerId)
GetItemByMetadata
Copy exports.origen_inventory: GetItemByMetadata (playerId, metaKey, metaValue)
GetItemsByMetadata
Copy exports.origen_inventory: GetItemsByMetadata (playerId, metaKey, metaValue)
GetItemByMetaKey
Copy exports.origen_inventory: GetItemByMetaKey (playerId, metaKey)
GetItemsByMetaKey
Copy exports.origen_inventory: GetItemsByMetaKey (playerId, metaKey)
GetItemInfoBySlot
Copy exports.origen_inventory: GetItemInfoBySlot (playerId, itemName, slot)
GetItemCount
Copy exports.origen_inventory: GetItemCount (playerId, itemName, metadata, strict)
GetItem
Copy exports.origen_inventory: GetItem (playerId, itemName, metadata, returnsCount)