Inventory

This is the way of how to get the Inventory API Functions.

local TPZInv = exports.tpz_inventory:getInventoryAPI()

Inventory API Functions

Player Inventory

Check if the player inventory contents have been loaded .

-- returns a boolean.
local loadedInventoryContents = TPZInv.loadedInventoryContents()

Get the player inventory contents.

-- returns a table.
local contents = TPZInv.getInventoryContents()

Check if the inventory is active.

-- returns a boolean.
local isInventoryActive = TPZInv.isInventoryActive()

Check if the secondary inventory is active.

-- returns a boolean.
local isSecondaryInventoryActive = TPZInv.isSecondaryInventoryActive()

Close player inventory.

TPZInv.closeInventory()
Containers

Open a container contents by its id

-- @param containerId : requires the container id (not name).
-- @param header : requires the header (title) of the container.
-- @param isTarget : requires a boolean value (false / true) if the container is a player / not.
-- @param disable : requires a boolean value (false / true) to disable the player inventory items to be transferred to the container contents.
-- @param itemsList : a non-required parameter used to enable or disable the transfer of specific items.
-- This parameter requires a table form as { type = 'ALLOWLISTED' or 'BLACKLISTED', items = { 'item1', 'item2' } }
TPZInv.openInventoryContainerById(containerId, header, isTarget, disable, itemsList)

Open a container contents by its name - v.1.0.0+

-- @param containerName: requires the container name (not id).
-- @param header : requires the header (title) of the container.
-- @param isTarget : requires a boolean value (false / true) if the container is a player / not.
-- @param disable : requires a boolean value (false / true) to disable the player inventory items to be transferred to the container contents.
-- @param itemsList : a non-required parameter used to enable or disable the transfer of specific items.
-- This parameter requires a table form as { type = 'ALLOWLISTED' or 'BLACKLISTED', items = { 'item1', 'item2' } }
TPZInv.openInventoryContainerByName(containerName, header, isTarget, disable, itemsList)
Weapons

Get current used weapon data .

-- @param weaponData.ammoType : returns nil on throwables, lanterns, torches, knifes, except firing weapons.
-- @param weaponData.ammo : returns 0 on lanterns, torches, knifes, except firing weapons and throwables, throwables are always (1).
-- @param weaponData.weaponId : returns the unique weapon identifier of the holding weapon when being used.
-- @param weaponData.name, weaponData.hash (string), weaponData.durability, weaponData.metadata, obvious returns.
local weaponData = TPZInv.getUsedWeaponData()

Last updated