Server
Items
exports['ak47_inventory']:Items()exports['ak47_inventory']:Items('water')AddItem
exports['ak47_inventory']:AddItem(inv, item, amount, slot, info, weight, expiretime)inv:
stringornumberplayer id or unique inventory identifier
item:
stringitem name
amount:
numberamount of the item
slot:
number(optional)slot value
info:
table(optional)item metadata table
weight:
number(optional)change the weight of this item
expiretime:
number(optional)change expire time of this item
RemoveItem
exports['ak47_inventory']:RemoveItem(inv, item, amount, slot)inv:
stringornumberplayer id or unique inventory identifier
item:
stringitem name
amount:
numberamount of the item
slot:
number(optional)slot value
GetItem
exports['ak47_inventory']:GetItem(inv, item, info, strict)inv:
stringornumberitem:
stringitem name
info?:
table(optional)strict?:
boolean(optional)full match or partial match
GetFirstItem
exports['ak47_inventory']:GetFirstItem(inv, item)inv:
stringornumberitem:
stringitem name
Return: table
first item table with total item amount & properties
Return: table
item table with total item amount & properties
CanAddItem
exports['ak47_inventory']:CanAddItem(identifier, item, amount, skipWeight)identifier:
stringornumberplayer id or inventory identifier
item
stringitem name
amount:
numberskipWeight?:
boolean(optional)if true then it will not check weight. Only check if there is any slot available
Return: boolean
CanCarryAmount
exports['ak47_inventory']:CanCarryAmount(identifier, item)identifier:
stringornumberplayer id or inventory identifier
item
stringitem name
Return: number
CanCarryWeight
exports['ak47_inventory']:CanCarryWeight(identifier, weight)identifier:
stringornumberplayer id or inventory identifier
weight:
number
Return: boolean, number
canHold
availableWeight
SetMaxWeight
exports['ak47_inventory']:SetMaxWeight(identifier, newWeight)identifier:
stringornumberplayer id or inventory identifier
newWeight:
number
CanSwapItem
Returns true if the item swap is possible based on inventory weight.
exports['ak47_inventory']:CanSwapItem(inv, firstItem, firstItemCount, testItem, testItemCount)inv:
stringornumberfirstItem:
stringfirstItemAmount:
numbertestItem:
stringtestItemAmount:
number
Return: boolean
GetAmount
exports['ak47_inventory']:GetAmount(identifier, item, info, strict)identifier:
stringornumberitem:
stringitem name
info?:
table(optional)strict?:
boolean(optional)full match or partial match
Return: number
GetSlot
exports['ak47_inventory']:GetSlot(identifier, slot)identifier:
stringornumberslot:
number
Return: table
item table of that slot
GetSlotForItem
exports['ak47_inventory']:GetSlotForItem(identifier, itemName, info)identifier:
stringornumberitemName:
stringinfo:
table?
Return: number
slotId
GetSlotIdWithItem
exports['ak47_inventory']:GetSlotIdWithItem(identifier, itemName, info, strict)identifier:
stringornumberitemName:
stringinfo?:
tablestrict?:
booleanstrictly match info properties, otherwise use partial matching.
Return: number
slotId
GetSlotIdsWithItem
exports['ak47_inventory']:GetSlotIdsWithItem(inv, itemName, info, strict)identifier:
stringornumberitemName:
stringinfo?:
tablestrict?:
booleanStrictly match info properties, otherwise use partial matching.
Return: table
slotIds:
GetSlotsWithItem
exports['ak47_inventory']:GetSlotsWithItem(identifier, itemName, info, strict)identifier:
stringornumberitemName:
stringinfo?:
tablestrict?:
booleanStrictly match info properties, otherwise use partial matching.
Return: table
slotsData
GetEmptySlot
exports.ox_inventory:GetEmptySlot(identifier)identifier:
stringornumber
Return: number
slotId
GetContainerFromSlot
exports['ak47_inventory']:GetContainerFromSlot(identifier, slotId)identifier:
stringornumberslotId:
number
Return: table
containerData
SetSlotCount
exports['ak47_inventory']:SetSlotCount(identifier, slots)identifier:
stringornumberslots:
number
GetInventory
exports['ak47_inventory']:GetInventory(identifier)identifier:
stringornumber
Return: table
inventoryTable
GetInventoryItems
exports['ak47_inventory']:GetInventoryItems(identifier)identifier:
stringornumber
Return: table
inventoryItemsTable
SetInvItems
exports['ak47_inventory']:SetInvItems(identifier, items)identifier:
stringornumberitems:
table
ConfiscateInventory
exports['ak47_inventory']:ConfiscateInventory(identifier)identifier:
stringornumber
ReturnInventory
exports['ak47_inventory']:ReturnInventory(identifier)identifier:
stringornumber
ClearInventory
exports['ak47_inventory']:ClearInventory(identifier)identifier:
stringornumber
ClearClothing
exports['ak47_inventory']:ClearClothing(identifier)identifier:
stringornumber
Search
exports['ak47_inventory']:Search(identifier, search, item, info)identifier:
stringornumbersearch:
stringitem:
tableorstringinfo?:
tableorstring
search can be either 'slots' or 'count', where slots will return a table of data and count will return the found amount of the specified item.
CreateInventory
exports['ak47_inventory']:CreateInventory(identifier, data)identifier:
stringdata:
tablelabel:
stringmaxWeight:
numberslots:
numbertype:
stringbackpack, stash, player, shop, trunk, glovebox
type2:
stringornilsmallBackpack, largeBackpack (only use for backpack)
temp:
booleanornilis this a temporary inventory?
whitelist:
tableornillist of whitelisted items or nil
blacklist:
tableornillist of blacklisted items or nil
Example:
-- server side
exports['ak47_inventory']:CreateInventory('housing:123', {
label = 'Housing',
maxWeight = 500000,
slots = 50,
type = 'stash',
})
--open from server side
exports['ak47_inventory']:OpenInventory(source, 'housing:123')
--open from client side
exports['ak47_inventory']:OpenInventory('housing:123')LoadInventory
load an existing inventory from databse
exports['ak47_inventory']:LoadInventory(identifier)--if missing in database then create & load an inventory
exports['ak47_inventory']:LoadInventory(identifier, data)Return: boolean
Example:
-- server side
exports['ak47_inventory']:LoadInventory('housing:123', {
label = 'Housing',
maxWeight = 500000,
slots = 50,
type = 'stash',
})UnloadInventory
exports['ak47_inventory']:UnloadInventory(identifier)identifier:
stringornumber
SetWhitelistedItemsForContainer
exports['ak47_inventory']:SetWhitelistedItemsForContainer(identifier, items)identifier:
stringornumberitems:
table
Example:
exports['ak47_inventory']:SetWhitelistedItemsForContainer('stash:123', {'water', 'bread'})SetBlacklistedItemsForContainer
exports['ak47_inventory']:SetBlacklistedItemsForContainer(identifier, items)identifier:
stringornumberitems:
table
Example:
exports['ak47_inventory']:SetBlacklistedItemsForContainer('stash:123', {'water', 'bread'})GetCurrentWeapon
exports['ak47_inventory']:GetCurrentWeapon(identifier)identifier:
stringornumber
Return: table
currentWeapon
SetQuality
exports['ak47_inventory']:SetQuality(identifier, slot, quality)identifier:
stringornumberslot:
numberquality:
number
SetItemInfo
exports['ak47_inventory']:SetItemInfo(identifier, slot, info)identifier:
stringornumberslot:
numberinfo:
table
RemoveQuality
exports['ak47_inventory']:RemoveQuality(identifier, slot, value)identifier:
stringornumberslot:
numbervalue:
number
SaveInventory
exports['ak47_inventory']:SaveInventory(identifier)identifier:
stringornumber
DeleteInventory
exports['ak47_inventory']:DeleteInventory(identifier)identifier:
stringornumber
SaveAllInventory
exports['ak47_inventory']:SaveAllInventory()OnChangeVehiclePlate
exports['ak47_inventory']:OnChangeVehiclePlate(oldPlate, newPlate)oldPlate:
stringnewPlate:
string
Last updated