Client
Client-side exports for ak47_inventory.
Core Operations
Ready
Checks if the player inventory system has fully loaded and is ready.
local isReady = exports['ak47_inventory']:Ready()- Returns:
boolean(trueif ready,falseotherwise)
UI & Inventory Management
OpenInventory
Opens the inventory interface for a target stash, dynamic inventory, or player.
exports['ak47_inventory']:OpenInventory(data)| Parameter | Type | Required | Description |
|---|---|---|---|
data |
table / string / number | Yes | Stash identifier, player server ID, or dynamic inventory table |
exports['ak47_inventory']:OpenInventory('stash:1234')exports['ak47_inventory']:OpenInventory({
identifier = 'stash:1234',
label = 'Housing Stash',
type = 'stash',
maxWeight = 120000,
slots = 50,
})-- Target player server ID
exports['ak47_inventory']:OpenInventory(5)OpenNearbyInventory
Opens the inventory interface of the nearest player.
exports['ak47_inventory']:OpenNearbyInventory()CloseInventory
Forces the inventory interface to close for the local player.
exports['ak47_inventory']:CloseInventory()SetInventoryBusy
Toggles the busy state of the inventory interface.
exports['ak47_inventory']:SetInventoryBusy(busy)| Parameter | Type | Required | Description |
|---|---|---|---|
busy |
boolean | Yes | Lock state (true to lock, false to unlock) |
Data Retrieval & Getters
Items
Retrieves the shared item configuration table or a specific item definition.
local items = exports['ak47_inventory']:Items(itemName)| Parameter | Type | Required | Description |
|---|---|---|---|
itemName |
string | No | Specific item name or nil for all items |
- Returns:
table(Shared item definitions or single item data)
GetItem
Retrieves consolidated item data from the local player inventory.
local itemData = exports['ak47_inventory']:GetItem(name, info, strict)| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Item identifier name |
info |
table | No | Metadata filter table |
strict |
boolean | No | Strict metadata match flag |
- Returns:
table(Item data table with combined count and properties)
GetFirstItem
Retrieves the first occurrence of an item found in the inventory.
local itemData = exports['ak47_inventory']:GetFirstItem(item)| Parameter | Type | Required | Description |
|---|---|---|---|
item |
string | Yes | Item identifier name |
- Returns:
table(First found item table)
GetItemLabel
Retrieves the display label string of a specified item.
local label = exports['ak47_inventory']:GetItemLabel(name)| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Item identifier name |
- Returns:
string(Item display label)
HasItems
Checks if the player inventory contains a list of required items.
local hasAll, missingItems = exports['ak47_inventory']:HasItems(items)| Parameter | Type | Required | Description |
|---|---|---|---|
items |
table | Yes | Key-value table of required items and amounts |
- Returns:
boolean,table(Status boolean and missing items table)
Search
Searches inventory for item counts or specific slot data.
local result = exports['ak47_inventory']:Search(searchType, item, info)| Parameter | Type | Required | Description |
|---|---|---|---|
searchType |
string | Yes | Search mode ('slots' or 'amount') |
item |
string / table | Yes | Single item name or array of item names |
info |
table / string | No | Metadata filter table or string match |
- Returns:
numberortable(Item quantity or slot data tables)
GetAmount
Calculates total quantity of a specific item across all stacks.
local totalAmount = exports['ak47_inventory']:GetAmount(itemName, info, strict)| Parameter | Type | Required | Description |
|---|---|---|---|
itemName |
string | Yes | Item identifier name |
info |
table | No | Metadata filter table |
strict |
boolean | No | Strict metadata match flag |
- Returns:
number(Total quantity of item)
GetPlayerItems
Retrieves an array of all items currently in the player inventory.
local items = exports['ak47_inventory']:GetPlayerItems()- Returns:
table(Array of item data tables)
GetPlayerWeight
Retrieves current total weight of all carried items.
local currentWeight = exports['ak47_inventory']:GetPlayerWeight()- Returns:
number(Current carried weight in grams)
GetPlayerMaxWeight
Retrieves maximum carry weight capacity of player inventory.
local maxWeight = exports['ak47_inventory']:GetPlayerMaxWeight()- Returns:
number(Maximum weight limit in grams)
Slot Operations
GetSlotWithItem
Retrieves slot data of first slot containing specified item.
local slotData = exports['ak47_inventory']:GetSlotWithItem(itemName, info, strict)| Parameter | Type | Required | Description |
|---|---|---|---|
itemName |
string | Yes | Item identifier name |
info |
table | No | Metadata filter table |
strict |
boolean | No | Strict metadata match flag |
- Returns:
tableornil(Slot data table or nil if not found)
GetSlotIdWithItem
Retrieves slot index number of first slot containing specified item.
local slotId = exports['ak47_inventory']:GetSlotIdWithItem(itemName, info, strict)| Parameter | Type | Required | Description |
|---|---|---|---|
itemName |
string | Yes | Item identifier name |
info |
table | No | Metadata filter table |
strict |
boolean | No | Strict metadata match flag |
- Returns:
numberornil(Slot ID number or nil if not found)
GetSlotsWithItem
Retrieves array of all slot data tables containing specified item.
local slots = exports['ak47_inventory']:GetSlotsWithItem(itemName, info, strict)| Parameter | Type | Required | Description |
|---|---|---|---|
itemName |
string | Yes | Item identifier name |
info |
table | No | Metadata filter table |
strict |
boolean | No | Strict metadata match flag |
- Returns:
tableornil(Array of slot data tables)
GetSlotIdsWithItem
Retrieves array of all slot index numbers containing specified item.
local slotIds = exports['ak47_inventory']:GetSlotIdsWithItem(itemName, info, strict)| Parameter | Type | Required | Description |
|---|---|---|---|
itemName |
string | Yes | Item identifier name |
info |
table | No | Metadata filter table |
strict |
boolean | No | Strict metadata match flag |
- Returns:
tableornil(Array of slot index numbers)
GetSlot
Retrieves item data stored at a specific slot index.
local itemData = exports['ak47_inventory']:GetSlot(slotId)| Parameter | Type | Required | Description |
|---|---|---|---|
slotId |
number | Yes | Slot index number to query |
- Returns:
tableornil(Item data table or nil if empty)
UseSlot
Triggers use action for item currently in specified slot index.
exports['ak47_inventory']:UseSlot(slotId)| Parameter | Type | Required | Description |
|---|---|---|---|
slotId |
number | Yes | Slot index number to trigger |
Weapon Operations
UnEquipeWeapon
Unequips currently held weapon from player hands.
exports['ak47_inventory']:UnEquipeWeapon()