Server-side

Server export

GetItemList - Get the list of items from qs-inventory.

-- Get the full table of shared/items.lua
exports['qs-inventory']:GetItemList()

GetWeaponList - Get the list of weapons from qs-inventory.

-- Get the full table of shared/weapons.lua
exports['qs-inventory']:GetWeaponList()

GetInventory - Check the player's inventory, useful for checking items or meta items.

-- player: Player source or identifier
exports['qs-inventory']:GetInventory(player)
-- source: Player source
-- item: Name of the item to deliver
-- count: Quantity of the item to deliver
-- slot: Choose a specific slot or use nil to use the last empty
-- metadata: Insert the metadata you want to give to the item, valid number and string
exports['qs-inventory']:AddItem(source, item, count, slot, metadata)

You can also use it this way if you want to add items without the need for metadata.

-- source: Player source
-- item: Name of the item to deliver
-- count: Quantity of the item to deliver
exports['qs-inventory']:AddItem(source, item, count)
-- source: Player source
-- item: Name of the item to remove
-- count: Quantity of the item to remove
-- slot: Choose a specific slot or use nil to use the last empty
-- metadata: Insert the metadata you want to give to the item, valid number and string
exports['qs-inventory']:RemoveItem(source, item, count, slot, metadata)

You can also use it in the following way if you want to add items without the need for metadata.

-- source: Player source
-- item: Name of the item to remove
-- count: Quantity of the item to remove
exports['qs-inventory']:RemoveItem(source, item, count)

CanCarryItem - Use it to check whether or not you can carry an item.

-- source: Player source
-- item: Name of the item
-- amount: Quantity of the item
exports['qs-inventory]:CanCarryItem(source, item, amount)

GetItemTotalAmount - Use it to check the total quantity of an item in the inventory.

-- source: Player source
-- item: Name of the item
exports['qs-inventory']:GetItemTotalAmount(source, item)

SetItemMetadata - Used to give metadata to an existing item.

-- player: Player source or identifier
-- slot: Find the item slot or items[item.slot] using GetInventory
-- metadata: Metadata to insert
exports['qs-inventory']:SetItemMetadata(player, slot, metadata)

CreateUsableItem - Create items using QS logic, useful for giving metadata.

-- item: Name of the item you want to create
-- cb: Item creation logic identical to your framework's
exports['qs-inventory']:CreateUsableItem(item, cb)

SetMetaData - Used to deliver specific metadata to the player.

-- player: Player Citizenid or identifier
-- info: Name of the metadata you want to insert
-- metadata: Information of the inserted metadata, valid number and string
exports['qs-inventory']:SetMetaData(player, { info = metadata })

GetMetaData - Check a specific metadata of a player.

-- player: Player identifier
exports['qs-inventory']:GetMetaData(player)

GiveItemToPlayer - Useful to deliver items with metadata, configure it in server/custom.

-- source: Player source
-- item: Name of the item to deliver
-- count: Quantity of the item to deliver
exports['qs-inventory']:GiveItemToPlayer(source, item, count)

GetTotalUsedSlots - Get the used slots in your inventory.

-- source: Player source
exports['qs-inventory']:GetTotalUsedSlots(source)

RegisterStash - Create stashes with a simple export.

-- source: Player source
-- stash: stash identifier
-- slots: Total stash slots
-- weight: Total stash space
exports['qs-inventory']:RegisterStash(source, stash, slots, weight)

AddItemIntoStash - Add items to a stash externally.

-- stashid: Stash id, example 'stash_house'
-- item: item to add, example 'bread'
-- amount: item amount
-- slot: slot or nil
-- info: metadata information or nil
-- slots: stash slots
-- maxWeight: stash weight
exports['qs-inventory']:AddItemIntoStash(stashid, item, amount, slot, info, slots, maxWeight)

RemoveItemIntoStash- Remove items to a stash externally.

-- stashid: Stash id, example 'stash_house'
-- item: item to add, example 'bread'
-- amount: item amount
-- slot: item slot or nil
-- slots: stash slots
-- maxWeight: stash weight
exports['qs-inventory']:RemoveItemIntoStash(stashid, item, amount, slot, slots, maxWeight)

GetStashItems - Check items within a certain stash.

-- stashid: Stash id, example 'stash_house'
exports['qs-inventory']:GetStashItems(stashid)

Last updated