Client

GetItemList | Items

Optionally takes the name of an item, returning only data for that item

exports["tgiann-inventory"]:GetItemList()
exports["tgiann-inventory"]:Items()
Name
Type

itemName?

string

Return :

value
type

Item list or Item Data

table

Example

local allItems = exports["tgiann-inventory"]:GetItemList()
local allItems = exports["tgiann-inventory"]:Items()

local bandage = exports["tgiann-inventory"]:GetItemList("bandage")
local bandage = exports["tgiann-inventory"]:Items("bandage")

GetItemLabel

exports["tgiann-inventory"]:GetItemLabel(item)

Return :

value
type

İtem label

string

Parameters :

Name
Type
Description

item

string

Item spawn name

Example

local label = exports["tgiann-inventory"]:GetItemLabel("bandage")

GetPlayerItems

exports["tgiann-inventory"]:GetPlayerItems()

Return :

value
type

player items

table

Example

local playerItems = exports["tgiann-inventory"]:GetPlayerItems()

GetPlayerClotheItems

exports["tgiann-inventory"]:GetPlayerClotheItems()

Return :

value
type

Player clothe items

table

Example

local playerClotheItems = exports["tgiann-inventory"]:GetPlayerClotheItems()

GetCarryItemData

exports["tgiann-inventory"]:GetCarryItemData()

Return :

value
type

Data of the item the player is carrying

table or false

Example

--[[ 
data = {
    item = "bandage", -- Item Name
    object = 12312312, -- Spawned object id
}
--]]
local data = exports["tgiann-inventory"]:GetCarryItemData()

IsCarryingItem

exports["tgiann-inventory"]:IsCarryingItem()

Return :

value
type

Does the player carry things in his hand?

boolen

Example

local IsCarryingItem = exports["tgiann-inventory"]:IsCarryingItem()

HasItem

exports["tgiann-inventory"]:HasItem(items, amount)

Return :

value
type

Player has the item

boolen

Parameters :

Name
Type
Description

items*

table or string

The items to check, either a string, array of strings or a key-value table of a string and number with the string representing the name of the item and the number representing the amount

amount

int

The amount of the item to check for, this will only have effect when items is a string or an array of strings

Example

local has1 = exports["tgiann-inventory"]:HasItem("bandage", 2)
local has2 = exports["tgiann-inventory"]:HasItem({"bandage", "armor"}, 2)

OpenInventory

Same function as the F2(default) key

exports["tgiann-inventory"]:OpenInventory(invType, invId, invData, openType)

Parameters :

Name
Type
Description

invType

string

glovebox | trunk | stash | shop | drop | crafting | otherplayer

invId

string | number

playerid | name | plate

invData

table | null

{ maxweight?: number, slots?: number, whitelist?: table, blacklist?: table, label?:string}

openType

table | null

{ isPlayer?: boolen, isFamily?: boolen, password?: string}

Examples :

exports["tgiann-inventory"]:OpenInventory() -- Default Player Inventory (F2)
exports["tgiann-inventory"]:OpenInventory("shop", "market_1", "market_1")
exports["tgiann-inventory"]:OpenInventory("drop", "drop_123")
exports["tgiann-inventory"]:OpenInventory("stash", "test_stash", { maxweight = 50000, slots = 20 })

CloseInventory

exports["tgiann-inventory"]:CloseInventory()

SetInventoryActive

turns inventory usage off or on, when off, the player cannot open and use their inventory

exports["tgiann-inventory"]:SetInventoryActive(boolen)

ToggleHotbar

exports["tgiann-inventory"]:ToggleHotbar(isOpen)

Parameters :

Name
Type
Description

isOpen*

boolen

Opens the hotbar if true, closes it if false

Example

exports["tgiann-inventory"]:ToggleHotbar(true)
exports["tgiann-inventory"]:ToggleHotbar(false)

SetCanUseItem

turns off or on item usage in inventory, Player can't use items in their inventory when closed

exports["tgiann-inventory"]:SetCanUseItem(boolen)

IsInventoryActive

Returns the value modified with SetInventoryActive

local isActive = exports["tgiann-inventory"]:IsInventoryActive()

LastWeaponData

Returns the weapon in his hand and all weapons he uses within 30 seconds

local lastWeaponData, lastWeaponDataForDrop = exports["tgiann-inventory"]:LastWeaponData()

ResetWeaponDataForDrop

Within 30 seconds, resets the data of all weapons used

exports["tgiann-inventory"]:ResetWeaponDataForDrop()

GetCurrentWeapon | getCurrentWeapon | LastWeaponData

Get data for the currently equipped weapon

exports["tgiann-inventory"]:GetCurrentWeapon()
exports["tgiann-inventory"]:getCurrentWeapon()
exports["tgiann-inventory"]:LastWeaponData()

FastSlotAddItem

adds items to the fast slot. remember, if there is no item in your inventory, you cannot use the item in the fast slot

exports["tgiann-inventory"]:FastSlotAddItem(slot, itemName)

Parameters :

Name
Type
Description

slot*

number

Slot number for fast slot bar(max 5)

itemName*

string

item name

Example

exports["tgiann-inventory"]:FastSlotAddItem(1, "bandage")

FastSlotRemoveItem

removes the item from the fast slot

exports["tgiann-inventory"]:FastSlotRemoveItem(slot)

Parameters :

Name
Type
Description

slot*

number

Slot number for fast slot bar(max 5)

Example

exports["tgiann-inventory"]:FastSlotRemoveItem(1)

FastSlotRemoveAllSlots

Removes all items in the fast slot

exports["tgiann-inventory"]:FastSlotRemoveAllSlots()

Searches the inventory for an item, or list of items, with the result varying based on the first argument.

exports["tgiann-inventory"]:Search(search, item, metadata)

Parameters :

Name
Type
Description

search

string

slots | count

item

string

Item name

metadata?

table

Item metadata for search

Example

local count = exports.ox_inventory:Search('count', 'bandage')
print('bandage count: '..count)

local items = exports.ox_inventory:Search('count', {'bandage', 'medikit'})
if items then
    for name, count in pairs(items) do
        print(name..' count: '..count)
    end
end

local waterSlots = exports.ox_inventory:Search('slots', 'water')
print(json.encode(waterSlots))

GetItemCount

Get the total item count for all items in the player's inventory with the given name and metadata.

exports["tgiann-inventory"]:GetItemCount(itemName, metadata, strict)

Parameters :

Name
Type
Description

itemName

string

Item name

metadata?

table

Item metadata for search

strict

boolean

Strictly match metadata properties, otherwise use partial matching.

Return

Name
Type

count

number


GetPlayerWeight

Get the total weight of all items in the player's inventory.

exports["tgiann-inventory"]:GetPlayerWeight()

Return

Name
Type

totalWeight

number


GetPlayerMaxWeight

Get the total weight of all items in the player's inventory.

exports["tgiann-inventory"]:GetPlayerMaxWeight()

Return

Name
Type

maxWeight

number


GetItemByName | GetSlotWithItem

Get data for a slot in the player's inventory matching the given name and metadata.

exports["tgiann-inventory"]:GetItemByName(itemName, metadata, strict)
exports["tgiann-inventory"]:GetSlotWithItem(itemName, metadata, strict)

Parameters :

Name
Type
Description

itemName

string

Item name

metadata?

table

Item metadata for search

strict

boolean

Strictly match metadata properties, otherwise use partial matching.

Return

Name
Type

itemData

table


GetItemsByName | GetSlotsWithItem

Get data for a slot in the player's inventory matching the given name and metadata.

exports["tgiann-inventory"]:GetItemsByName(itemName, metadata, strict)
exports["tgiann-inventory"]:GetSlotsWithItem(itemName, metadata, strict)

Parameters :

Name
Type
Description

itemName

string

Item name

metadata?

table

Item metadata for search

strict

boolean

Strictly match metadata properties, otherwise use partial matching.

Return

Name
Type

itemsData

table


GetSlotIdWithItem

Get a slot id in the player's inventory matching the given name and metadata.

exports["tgiann-inventory"]:GetSlotIdWithItem(itemName, metadata, strict)

Parameters :

Name
Type
Description

itemName

string

Item name

metadata?

table

Item metadata for search

strict

boolean

Strictly match metadata properties, otherwise use partial matching.

Return

Name
Type

slotNumber

number


GetSlotIdsWithItem

Get all slot ids in the player's inventory matching the given name and metadata.

exports["tgiann-inventory"]:GetSlotIdsWithItem(itemName, metadata, strict)

Parameters :

Name
Type
Description

itemName

string

Item name

metadata?

table

Item metadata for search

strict

boolean

Strictly match metadata properties, otherwise use partial matching.

Return

Name
Type

slotsNumber

table


UseSlot | useSlot

Uses the item in the given inventory slot.

exports["tgiann-inventory"]:useSlot(slot)

Parameters :

Name
Type
Description

slot

number

Slot number (1-5)


GiveItemToTarget | giveItemToTarget

Uses the item in the given inventory slot.

exports["tgiann-inventory"]:GiveItemToTarget(serverId, slotId, count)

Parameters :

Name
Type
Description

serverId

number

Target player server id

slotId

number

Slot id

count

number

The amount of the item to give

Last updated