TGIANN
YoutubeDiscordTebexFivem
  • Main
    • Welcome
    • How to Find My Transaction ID
    • How can i download my script
    • How can i transfer my script
    • Whats escrow system?
    • Switching from MySQL Async to oxmysql
    • Basic Aces & Principals overview/guide
    • Using QB scripts in QBOX
    • How can i use Fivemanage
  • Common errors
    • SCRIPT ERROR: ?:-1: attempt to call a nil value
    • TGIANN-Core script is not in my keymaster account
    • You lack the required entitlement to use tgiann-*
    • Error parsing script / Failed to load script
    • Error: syntax error near '<\1>'
    • When I buy something, the money goes negative
    • Failed to verify protected resource
  • Map
    • lumi-delperropier
      • Setup
      • Conflicts
      • Disable NPC
      • Rcore Funfair Cords
      • CS-Hall Config
  • Scripts
    • tgiann-animpos-photo-cam
      • Editable Files
      • Config File
      • Exports
    • tgiann-self-storage-v2
      • Editable Files
        • Language File
        • Client Editable
        • Server Editable
      • Config File
    • tgiann-radio
      • Guides
        • Recommended settings for PMA Voice
        • How to change the animation
      • Installation
      • Config file
      • Editable Files
        • Language File
        • Client Editable
        • Server Editable
      • Exports
    • tgiann-core
      • Config file
      • Exports
      • Integration
        • QB
          • DrawText
    • tgiann-lumihud
      • Events / Exports
      • Editable Files
        • Language File
        • Client
          • playerStatus.lua
          • qbclient.lua
          • editable.lua
          • moneyEditable.lua
          • harnessBeltEditable.lua
        • Server
          • qbserver.lua
          • editable.lua
      • Config Files
        • config.lua
        • configHudSettings
        • configWeaponList.lua
        • qbStressConfig
      • Integration
        • Notify
        • Progressbar
    • tgiann-realparking
      • Events / Exports
      • Editable Files
        • Language File
        • Client
          • editable.lua
        • Server
          • editable.lua
      • Config Files
        • blipsConfig.lua
        • config.lua
        • impoundConfig.lua
        • insuranceConfig.lua
    • tgiann-vehicleshop
      • Exports
      • Editable Files
        • Language File
        • Client
          • editable.lua
        • Server
          • editable.lua
          • commands.lua
      • Config Files
    • tgiann-gps
      • Client Exports
      • Editable Files
        • config.lua
        • client/editable.lua
        • Language File
    • tgiann-clothing
      • Guides
        • Installation
          • ESX
          • QB
          • QBX
          • tgiann-inventory clothe items
        • Migration
        • How to take clothes images
      • Comman Proplems
      • Events / Exports
      • Admin Commands
      • Editable Files
        • client/editable.lua
        • server/editable.lua
      • Configs
        • blacklist
          • famale.lua
          • male.lua
        • clotheList
          • global
            • female.lua
            • male.lua
        • clothingPrice
          • female.lua
          • male.lua
        • tattoo
          • customTattoo.lua
          • tattoo.lua
        • clothingRoomsOutfits.lua
        • config.lua
        • hairOverlays.lua
        • pedList.lua
    • tgiann-inventory
      • Guides
        • Installation
          • ESX
          • QB
          • QBOX
        • How to adapt your script
        • How do money as item
          • QB
          • QBOX
          • ESX
            • ESX V11
            • ESX V12
        • Creating Items
        • Item İmages
        • Item Metadata
        • Migration
      • Common Problems
      • Exports
        • Server
        • Client
      • Hooks
      • Events
        • Server
        • Client
      • Admin Commands
      • Editable Files
        • client/editable.lua
        • client/topheader.lua
        • server/editable.lua
        • server/commands.lua
        • server/convert.lua
      • Configs
        • config.lua
        • configAmmo.lua
        • configAntiSwimingItems
        • configAttachment.lua
        • configAttachmentName.lua
        • configBlockItems.lua
        • configCarryItems.lua
        • configClotheBackpack.lua
        • configCommands.lua
        • configCraft.lua
        • configDecayableItems.lua
        • configDrop.lua
        • configEditableItems.lua
        • configFilter.lua
        • configItemStash.lua
        • configMaxStack.lua
        • configMaxUseAmount.lua
        • configMetadata.lua
        • configMetadataAdvance.js
        • configRealisticArmor.lua
        • configShop.lua
        • configStashes.lua
        • configThrowableItems.lua
        • configVendingMachine.lua
        • configWeapon.lua
    • lumi-delperropier-texonstone
      • Setup
    • tgiann-antirpf
      • Editable files
    • tgiann-secondhand
      • Editable files
      • config.lua
    • tgiann-multicharacter + spawn selector
      • Guides
        • Installation
        • Discord Permmission integration
        • Tebex integration
      • Common Problems
      • Configs
        • config.lua
        • multicharConfig.lua
        • photocamConfig.lua
        • spawnSelectorConfig.lua
      • Editable Files
        • Language File
        • client/editable.lua
        • server/editable.lua
        • server/commands.lua
    • tgiann-attachment
      • Config file
      • Event List
    • tgiann-bank
      • Migration
      • Exports
      • Config files
        • config.lua
        • configGangAccounts.lua
        • configHacking.lua
        • configJob.lua
        • configJobAccounts.lua
      • Editable Files
    • tgiann-bettercombat
      • Config file
      • Event List
    • tgiann-bobcat
      • Config file
    • tgiann-boombox
      • Config file
    • tgiann-vehiclecontrol
      • Exports
      • Config file
      • Editable Files
    • tgiann-card
      • Config file
      • QB Core Item
      • Ox Inventory Item
      • Sql File
    • tgiann-carhud
      • Config file
    • tgiann-carmod
      • Config file
      • Sql File
    • tgiann-chair
      • Config file
      • QB Core Item
    • tgiann-chopshop
      • Config file
      • QB Core Item
    • tgiann-damage-indicator
      • Config file
      • Editable files
    • tgiann-dna
      • Sql File
    • tgiann-document
      • Config file
      • QB Core Item
      • Ox Inventory Item
      • Sql File
    • tgiann-doorlock-v2
      • How can i find door model and other details
      • Config file
    • tgiann-dropweaponwhendie
      • Config file
    • tgiann-drugsell
      • Config file
    • tgiann-erpv2
      • Config file
    • tgiann-fallouthacker
      • Usage
    • tgiann-garage
      • Config file
      • Event List
      • Exports List
      • QB Sql File
      • ESX Sql File
    • tgiann-hotwire
      • Item List
      • Editable Files
        • Language File
        • Client/editable.lua
        • Client/migrate.lua
        • Server/commands.lua
      • Config file
      • Exports
    • tgiann-house
      • Stash Function
      • Common errors
      • Config file
      • Event List
      • Sql File
      • Editable Files
    • tgiann-hud
      • Config file
    • tgiann-hudv2
      • Config file
      • Event List
    • tgiann-job
      • Config file
      • Sql File
    • tgiann-market
      • Editable Files
      • Config file
      • Sql File
    • tgiann-mdt
      • Config file
      • ESX Sql File
      • QB Sql File
    • tgiann-megaphone
      • Setup
        • QB Core Item
        • Ox Inventory Item
      • Language File
      • Config file
      • Event List
      • Exports List
      • Recommended PMA Voice Settings
      • Common Problems
    • tgiann-moder-hud
      • Config file
      • Editable files
      • Event list
    • tgiann-naked
      • Config file
      • Editable Files
      • Sql File
      • Wrong Clothes
    • tgiann-platechanger
      • Config file
    • tgiann-policealert
      • Config file
      • Event List
    • tgiann-postcard
      • Editable Files
      • Config file
      • QB Core Item
      • Ox Inventory Item
    • tgiann-radio (Old)
      • Common errors
      • Config file
      • Event List
      • Exports List
      • Recommended settings for PMA Voice
    • tgiann-rentscooter
      • Config file
    • tgiann-sblauncher
      • Config file
      • QB Core Item
    • tgiann-self-storage
      • Config file
      • Editable files
      • Sql File
    • tgiann-exit-log
      • Config file
      • Editable files
    • tgiann-weapons-on-back
      • Config file
      • Editable files
    • tgiann-sellnpc
      • Config file
    • tgiann-smokegrenade
      • Config file
    • tgiann-sounds
      • Example Usage
    • tgiann-stashhouse
      • Config file
      • Sql File
    • tgiann-statushud
    • tgiann-vehicleoutfit
      • Config file
      • Sql File
    • tgiann-vehicleradio
      • Config file
      • Event list
    • tgiann-vehicleshop
      • Config file
      • Sql File
    • tgiann-trade
      • Config file
      • Server editable.lua
      • Client editable.lua
    • tgiann-zombie
      • Config file
      • Client editable.lua
      • Server editable.lua
      • Common errors
    • tgiann-planting
      • Config file
      • Editable Files
    • tgiann-realistic-car-crash
      • Config file
      • Editable Files
    • tgiann-graphic-menu
      • Config file
      • Editable Files
    • tgiann-firefighterjob
      • Installation
      • Config file
      • Editable Files
    • tgiann-coinshop
      • Config file
      • Editable Files
    • tgiann-vehiclepaint
      • Config file
      • Setup
    • tgiann-drone
      • Config file
      • Editable Files
    • tgiann-musical-chairs
      • Config file
      • Editable Files
    • tgiann-pursuitmode
      • Config file
      • Editable Files
    • tgiann-food-jobs
      • Config file
      • Editable Files
      • Example Location Config
Powered by GitBook
On this page
  • OpenCraft
  • OpenInventoryById
  • ForceOpenInventoryById
  • OpenShop
  • OpenInventory | ForceOpenInventory
  • RegisterStash
  • LoadInventory
  • SaveInventory
  • SetInventory
  • GetItemList | Items
  • GetItemLabel
  • GetPlayerItems
  • GetPlayerClotheItems
  • GetTotalWeight
  • GetFreeWeight
  • GetSlotsByItem
  • GetFirstSlotByItem
  • SetItem
  • AddItem
  • RemoveItem
  • CloseInventory
  • CanCarryItem / CanAddItem
  • CanCarryItems
  • ClearInventory
  • GetItemByName
  • GetItemsByName
  • GetItemBySlot
  • GetItemCount
  • HasItem
  • RepairWeapon
  • CreateCustomStashWithItem
  • GetItemByNameFromSecondaryInventory
  • GetSecondaryInventoryItems
  • RemoveItemFromSecondaryInventory
  • AddItemToSecondaryInventory
  • UpdateItemMetadata / SetItemData
  • DeleteInventory
  • GiveClotheItem
  • RegisterShop
  • RegisterCraft
  • RegisterJobCraft
  • OpenInventoryById
  • OpenShop
  • SetMaxWeight
  • Search
  • UpdateVehicle
  • SaveAllInventory
  1. Scripts
  2. tgiann-inventory
  3. Exports

Server

You don't need to change functions like AddItem, RemoveItem, GetItemByName or etc in your other scripts, you can use qb's and esx's functions

OpenCraft

exports["tgiann-inventory"]:OpenCraft(src, categoryName)
name
type
Description

src

number

Player source id

categoryName

string

Category name in configCraft.lua


OpenInventoryById

exports["tgiann-inventory"]:OpenInventoryById(playerSrc, targetSrc, showClothe)
name
type
Description

playerSrc

number

Player source id

targetSrc

number

Target player source id

showClothe

boolean

Show target's clothing inventory


ForceOpenInventoryById

Ignores config.searchPlayer settings when opening another player's inventory.

exports["tgiann-inventory"]:ForceOpenInventoryById(playerSrc, targetSrc, showClothe)
name
type
Description

playerSrc

number

Player source id

targetSrc

number

Target player source id

showClothe

boolean

Show target's clothing inventory


OpenShop

exports["tgiann-inventory"]:OpenShop(src, shopName)
name
type
Description

src

number

Player source id

shopName

string

Products key name in configShop.lua


OpenInventory | ForceOpenInventory

Force Open Inventory has been added for those converting from Ox Inventory. Essentially, it works the same as OpenInventory, but it opens the inventory without considering values such as passwords.

Perhaps in the future, I'll migrate most functions to RegisterInventory. At that point, many of the current arguments will become obsolete, resulting in a more stable system.

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

src

number

invType

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

invId

"playerid" | "name" | "plate"

invData

{ maxWeight: number, slots: number, whitelist: string[], blacklist: string[], label: string, maxAmount: { [key:string]: number } }

openType

{ isPlayer: boolean, password: string }

Examples

exports["tgiann-inventory"]:ForceOpenInventory(source, "stash", "gang12", {
    maxWeight = 10000,
    slots = 10,
    whitelist = {"bandage", "item2"}
    label = "Gang Stash",
    maxAmount: { bandage = 5 }
}, {
    isPlayer: false,
    password: "1234"
})

exports["tgiann-inventory"]:ForceOpenInventory(source, "stash", "gang12", {
    maxWeight = 10000,
    slots = 10,
    label = "Gang Stash",
})

exports["tgiann-inventory"]:ForceOpenInventory(source, "otherplayer", otherSource)
exports["tgiann-inventory"]:ForceOpenInventory(source, "trunk", "PLATE123")

RegisterStash

exports["tgiann-inventory"]:RegisterStash(invId, label, slots, maxweight, owner, groups, coords, blacklist, whitelist)
Name
Type
Description

invId

string

playerid | name | plate

label

string

Inventory label

slots

number

Slot amount

maxweight

number

Max weight

owner

boolean

If true, the inventory is saved to the first player to open it.

groups

boolean

back compatibility for ox inv (currently not used)

coords

vector3

back compatibility for ox inv (currently not used)

blacklist

table

Blacklist items

ex: {"bandage", "item2"}

whitelist

table

Whitelist items ex: {"bandage", "item2"}


LoadInventory

exports["tgiann-inventory"]:LoadInventory(src)

Return :

value
type

items

table

Parameters :

Name
Type
Description

src

int

Player source id

Example

PlayerData.items = exports["tgiann-inventory"]:LoadInventory(source)

SaveInventory

exports["tgiann-inventory"]:SaveInventory(src)

Parameters :

Name
Type
Description

src

int

Player source id


SetInventory

exports["tgiann-inventory"]:SetInventory(src, items)

Parameters :

Name
Type
Description

src

int

Player source id

items

table

Player New Items


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(src)

Return :

value
type

player items

table

Parameters :

Name
Type
Description

src*

int

Player Source

Example

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

GetPlayerClotheItems

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

Return :

value
type

Player clothe items

table

Parameters :

Name
Type
Description

src*

int

Player Source

Example

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

GetTotalWeight

exports["tgiann-inventory"]:GetTotalWeight(items)

Return :

value
type

weight

int

Parameters :

Name
Type
Description

items*

table

İtem list with amount

Example

local items = {
    ["1"] = { item = "bandage", amount = 5},
    ["4"] = { item = "arrow", amount = 2},
}
local weight = exports["tgiann-inventory"]:GetTotalWeight(items)
return weight < 10

GetFreeWeight

exports["tgiann-inventory"]:GetFreeWeight(src)

Return :

value
type

Free weight

int

Parameters :

Name
Type
Description

src

int

Player source id

Example

local freeWeight = exports["tgiann-inventory"]:GetFreeWeight(src)
return freeWeight > 0

GetSlotsByItem

A table containing the slots where the item was found.

exports["tgiann-inventory"]:GetSlotsByItem(items, item)

Return :

value
type

slotsByItems

table

Parameters :

Name
Type
Description

items

table

Table The table containing the items.

itemName

string

string The name of the item to search for.


GetFirstSlotByItem

The slot number of the first matching item, or nil if no match is found.

exports["tgiann-inventory"]:GetFirstSlotByItem(items, itemName)

Return :

value
type

SlotNumber

int or nil

Parameters :

Name
Type
Description

items

table

The table of items to search through.

itemName

string

The name of the item to search for.


SetItem

exports["tgiann-inventory"]:SetItem(source, item, amount)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

source*

table

Player source

item*

string

item spawn name

amount*

int

the amount of item to set

Example

local src = source
local metadata = {
local success = exports["tgiann-inventory"]:SetItem(src, "bandage", 15)
if success then
    print("item set success")
end

AddItem

exports["tgiann-inventory"]:AddItem(source, item, amount, slot, metadata, isClotheSlot)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

source*

table

Player source

item*

string

item spawn name

amount*

int

the amount of item to add

slot

int

slot number

metadata

table

metadata of the item modify

isClotheSlot

boolen

adds item to clothe slots

Example

local src = source
local metadata = {
    level = 2
}
local success = exports["tgiann-inventory"]:AddItem(src, "bandage", 2, nil, metadata, false)
if success then
    print("item added")
end

RemoveItem

exports["tgiann-inventory"]:RemoveItem(source, item, amount, slot, metadata)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

source*

table

Player source

item*

string

item spawn name

amount*

int

the amount of item to add

slot

iny

slot number

metadata

table

item metadata value

Example

local src = source
local itemData = exports["tgiann-inventory"]:GetItemByName(src, "bandage")
if itemData.amount > 0 then
    local success = exports["tgiann-inventory"]:RemoveItem(src, "bandage", 1, itemData.key)
    if success then
        print("item added")
    end
end

CloseInventory

CloseInventory function closes the player inventory

exports["tgiann-inventory"]:CloseInventory(source)
Name
Type
Description

source

int

Player source

CanCarryItem / CanAddItem

exports["tgiann-inventory"]:CanCarryItem(source, item, amount)
exports["tgiann-inventory"]:CanAddItem(source, item, amount)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

source

int

Player source

item*

string

item spawn name

amount*

int

the amount of item to check

Example

local src = source
local canCarry = exports["tgiann-inventory"]:CanCarryItem(src, "bandage", 100)
if canCarry then
    exports["tgiann-inventory"]:AddItem(src, "bandage", 100)
end

CanCarryItems

exports["tgiann-inventory"]:CanCarryItems(source, items)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

source

int

Player source

items*

table

items table

amount*

int

the amount of item to check

Example

local src = source
local items = {
    {name = "bandage", amount = "3"}, 
    {name = "gold", amount = "1"}, 
}
local canCarry = exports["tgiann-inventory"]:CanCarryItems(src, items)
if canCarry then
    for i=1, #items do
        exports["tgiann-inventory"]:AddItem(src, items[i].name, items[i].amount)
    end
end

ClearInventory

exports["tgiann-inventory"]:ClearInventory(source, filterItems)
Name
Type
Description

source

int

Player source

filterItems

null | string | string[]

item name


GetItemByName

exports["tgiann-inventory"]:GetItemByName(source, item, metadata)

Return :

value
type

Player Item

table

Parameters :

Name
Type
Description

source

int

Player source

item

string

Item spawn name

metadata

table

Item metadata value

Example

local src = source
local itemData = exports["tgiann-inventory"]:GetItemByName(src, "bandage")
if itemData.amount > 0 then
    exports["tgiann-inventory"]:RemoveItem(src, "bandage", itemData.amount)
end

GetItemsByName

exports["tgiann-inventory"]:GetItemsByName(source, name, metadata)

Return :

value
type

Player Items

Table

Parameters :

Name
Type
Description

source

int

Player source

name

string

Item name

metadata

table

Item metadata value

Example

local src = source
local items = exports["tgiann-inventory"]:GetItemsByName(src, "bandage")
for i=1, #items do
    local itemData = items[i]
    exports["tgiann-inventory"]:RemoveItem(src, itemData.name, itemData.amount)
end

GetItemBySlot

exports["tgiann-inventory"]:GetItemBySlot(source, slot, metadata)

Return :

value
type

Player Items

Table

Parameters :

Name
Type
Description

source

int

Player source

slot

int

Slot number

metadata

table

Item metadata value

Example

local src = source
local slot = 1
local itemData = exports["tgiann-inventory"]:GetItemBySlot(src, slot)
if itemData.amount > 0 then
    exports["tgiann-inventory"]:RemoveItem(src, itemData.name, itemData.amount)
end

GetItemCount

The total count of the specified items.

exports["tgiann-inventory"]:GetItemCount(source, items)

Return :

value
type
Description

count

int | nil

The total count of the specified items.

Parameters :

Name
Type
Description

source

int

The player's source ID.

items

table | string

The items to count. Can be either a table of item names or a single item name.

HasItem

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

Return :

value
type

Player has the item

boolen

Parameters :

Name
Type
Description

src*

int

Player source

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 src = source
local has1 = exports["tgiann-inventory"]:HasItem(src, "bandage", 2)
local has2 = exports["tgiann-inventory"]:HasItem(src, {"bandage", "armor"}, 2)

RepairWeapon

exports["tgiann-inventory"]:RepairWeapon(src, slot, value)

Return :

value
type

Is success

boolen

Parameters :

Name
Type
Description

src*

int

Player source

slot*

int

Slot number

value

int

Repair values. Mix: 0, Max 100

Example

local src = source
local playerItems = exports["tgiann-inventory"]:GetPlayerItems(src)
for slot, itemData in pairs(playerItems) do
    if item.name == "weapon_pistol" then
        exports["tgiann-inventory"]:RepairWeapon(src, slot, 100)
    end
end

CreateCustomStashWithItem

Custom creates stash inventory

exports["tgiann-inventory"]:CreateCustomStashWithItem(stashUniqId, items)

Return :

value
type

stashUniqId

string

items

item list

Parameters :

Name
Type
Description

stashUniqId

string

Stash name

items

table

item list

Example

--Server
local items = {
    {
        name = "bandage"
        amount = 2,
    },
    {
        name = "waeapon_pistol"
        amount = 2,
        info = {
            ammo = 500
        }
    },
}
exports["tgiann-inventory"]:CreateCustomStashWithItem("airdrop_1", items)

--Client
TriggerServerEvent("tgiann-inventory:server:OpenInventory", "stash", "airdrop_1")

GetItemByNameFromSecondaryInventory

Returns the data of the item in the stash

exports["tgiann-inventory"]:GetItemByNameFromSecondaryInventory(invType, invName, item, metadata)

Return :

value
type

itemData

table

Parameters :

Name
Type
Description

invType

string

stash, trunk or glovebox

invName

string

Inventory name, id or plate

item

string

Item spawn name

metadata

table

Example

local itemData = exports["tgiann-inventory"]:GetItemByNameFromSecondaryInventory("stash", "airdrop_01", "bandage")
return itemData.amount > 0

GetSecondaryInventoryItems

Returns the data of the items in the stash

exports["tgiann-inventory"]:GetSecondaryInventoryItems(invType, invName)

Return :

value
type

Items

table

Parameters :

Name
Type
Description

invType

string

stash, trunk or glovebox

invName

string

Inventory name, id or plate

Example

local itemsData = exports["tgiann-inventory"]:GetSecondaryInventoryItems("stash", "airdrop_01", "bandage")

RemoveItemFromSecondaryInventory

Delete items from stash

exports["tgiann-inventory"]:RemoveItemFromSecondaryInventory(invType, invName, item, amount, slot, metadata)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

invType

string

stash, trunk or glovebox

invName

string

Inventory name, id or plate

item

string

item spawn name

amount

int

the amount of item to add

slot

int

Slot number

metadata

table

Example

local src = source
local stashId = "airdrop_01"
local itemData = exports["tgiann-inventory"]:GetItemByNameFromSecondaryInventory("stash", stashId, "bandage")
if itemData.amount > 0 then
    local success = exports["tgiann-inventory"]:RemoveItemFromSecondaryInventory("stash", stashId, "bandage", 1, itemData.slot)
    if success then
        print("item removed")
    end
end

AddItemToSecondaryInventory

Add items from stash

exports["tgiann-inventory"]:AddItemToSecondaryInventory(invType, invName, item, amount, slot, metadata)

Return :

value
type

success

boolen

Parameters :

Name
Type
Description

invType

string

stash, trunk or glovebox

invName

string

Inventory name, id or plate

item

string

item spawn name

amount

int

the amount of item to add

slot

int

Slot number

metadata

table

Example

local src = source
local stashId = "airdrop_01"
local success = exports["tgiann-inventory"]:AddItemToSecondaryInventory("stash", stashId, "bandage", 1)
if success then
    print("item added")
end

UpdateItemMetadata / SetItemData

Updates the item's info data

exports["tgiann-inventory"]:UpdateItemMetadata(src, item, slot, metadata)
exports["tgiann-inventory"]:SetItemData(src, item, slot, metadata)

Return : None

Parameters :

Name
Type
Description

src*

string

Stash uniq name

item*

string

item spawn name

slot*

string

Slot number

metadata*

table

Item new metadata

Example

local src = source
local itemData = exports["tgiann-inventory"]:GetItemByName(src, "weapon_pistol")
local newMetadata = {
    ammo = 200
}
exports["tgiann-inventory"]:UpdateItemMetadata(src, "weapon_pistol", itemData.slot, newMetadata)

DeleteInventory

deletes all data of the inventory

exports["tgiann-inventory"]:DeleteInventory(invType, invId)

Return : None

Parameters :

Name
Type
Description

invType*

string

trunk, glovebox, stash

invId*

string

Inventory uniq name or plate

Example

exports["tgiann-inventory"]:DeleteInventory("stash", "airdrop_01")
exports["tgiann-inventory"]:DeleteInventory("glovebox", "TL001TL")

GiveClotheItem

exports["tgiann-inventory"]:GiveClotheItem(src, model, itemName, data, isClotheSlot)

Return : None

Parameters :

Name
Type
Description

src*

int

Player source

model*

int

Player model (joaat("mp_f_freemode_01") or joaat("mp_m_freemode_01") )

itemName*

string

Clothe items

data*

table

Clothes data

isClotheSlot

bool

Add the item to the clothing slot

Example

local src = source
local model = joaat("mp_f_freemode_01")

--[[
    0: Helmet - Hat (c_helmet) (Prop)
    1: Mask (c_mask)
    1: Glasses (c_glasses) (Prop)
    2: Ear (c_ear) (Prop)
    4: Pants (c_pants)
    5: Bag (c_bag)
    6: Shoes (c_shoes)
    6: Watch (c_watch) (Prop)
    7: Chain (c_necklace)
    7: Bracelets (c_bracelet) (Prop)
    9: Kevlar (c_bproof)
    10: Decals (c_decal)
    
    3: Arms (c_torso)        
    8: Tshirt (c_torso)
    11: Torso (c_torso)
]]--

exports["tgiann-inventory"]:GiveClotheItem(src, model, "c_shoes", {
    ["6"] = { --shoes
        Prop = 26,
        Texture = 0
    }
}, false)

exports["tgiann-inventory"]:GiveClotheItem(src, model, "c_torso", {
    ["3"] = { --arms
        Prop = 3,
        Texture = 0
    },
    ["8"] = { --Tshirt
        Prop = 14,
        Texture = 0
    },
    ["11"] = { --Torso
        Prop = 60,
        Texture = 0
    }
}, false)

exports["tgiann-inventory"]:GiveClotheItem(src, model, "c_pants", {
    ["4"] = { --pants
        Prop = 39,
        Texture = 0
    },
}, false)

RegisterShop

exports["tgiann-inventory"]:RegisterShop(shopName, items)

Return : None

Parameters :

Name
Type
Description

shopName*

string

Uniq shop name

items*

table

item list

Example

local items = {
    { name = 'beer',    price = 7,  amount = 50, type = 'item' },
    { name = 'whiskey', price = 10, amount = 50, type = 'item' },
    { name = 'vodka',   price = 12, amount = 50, type = 'item' },
}
exports["tgiann-inventory"]:RegisterShop("policeshop2", items)

RegisterCraft

exports["tgiann-inventory"]:RegisterCraft(category, label, items)

Return : None

Parameters :

Name
Type
Description

category*

string

Uniq crafting category

label*

string

Crafting menu label

items*

table

item list

Example

local items = {
    { name = 'beer',    price = 7,  amount = 50, type = 'item' },
    { name = 'whiskey', price = 10, amount = 50, type = 'item' },
    { name = 'vodka',   price = 12, amount = 50, type = 'item' },
}
exports["tgiann-inventory"]:RegisterCraft("policecraft", "Fake Police Crafting", items)

RegisterJobCraft

exports["tgiann-inventory"]:RegisterJobCraft(jobName, label, items)

Return : None

Parameters :

Name
Type
Description

jobName*

string

Job name

label*

string

Crafting menu label

items*

table

item list

Example

local items = {
    { name = 'beer',    price = 7,  amount = 50, type = 'item' },
    { name = 'whiskey', price = 10, amount = 50, type = 'item' },
    { name = 'vodka',   price = 12, amount = 50, type = 'item' },
}
exports["tgiann-inventory"]:RegisterJobCraft("police", "Fake Police Crafting", items)

OpenInventoryById

Opens the inventory of a player by their ID

exports["tgiann-inventory"]:OpenInventoryById(src, targetSrc)

Parameters :

Name
Type
Description

src

int

The player's server ID.

targetSrc

int

The ID of the player whose inventory will be opened.


OpenShop

exports["tgiann-inventory"]:OpenShop(src, shopName)

Parameters :

Name
Type
Description

src

int

The player's server ID.

shopName

string

The name of the shop to open.


SetMaxWeight

exports["tgiann-inventory"]:SetMaxWeight(src, maxWeight)

Parameters :

Name
Type
Description

src

int

The player's server ID.

maxWeight

int

New max weight value


Search

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

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

Parameters :

Name
Type
Description

src

number

Player source id

search

string

slots | count

item

string

Item name

metadata?

table

Item metadata for search

Example

local count = exports["tgiann-inventory"]:Search(source, 'count', 'bandage')
print('bandage count: '..count)

local items = exports["tgiann-inventory"]:Search(source, 'count', {'bandage', 'medikit'})
if items then
    for name, count in pairs(items) do
        print(name..' count: '..count)
    end
end

local waterSlots = exports["tgiann-inventory"]:Search(source, 'slots', 'water')
print(json.encode(waterSlots))

UpdateVehicle

Update the internal reference to vehicle stashes, without triggering a save or updating the database.

exports["tgiann-inventory"]:UpdateVehicle(oldPlate, newPlate)

SaveAllInventory

This export allows you to save all currently unsaved inventories to the database.

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

PreviousExportsNextClient

Last updated 22 days ago