Inventory — Server

Functions

AddItem

Adds an item to a player’s inventory.

Bridge.Inventory.AddItem(src, item, amount, metadata, slot)
ParameterTypeDescription
srcnumberPlayer server ID
itemstringItem name
amountnumberAmount to add
metadatatableItem metadata (optional)
slotnumberTarget slot (optional)

RemoveItem

Removes an item from a player’s inventory.

Bridge.Inventory.RemoveItem(src, item, amount, metadata, slot)
ParameterTypeDescription
srcnumberPlayer server ID
itemstringItem name
amountnumberAmount to remove
metadatatableItem metadata (optional)
slotnumberSlot to remove from (optional)

GetItemCount

Returns the count of a specific item in a player’s inventory.

local count = Bridge.Inventory.GetItemCount(src, item, metadata)
-- Returns: number
ParameterTypeDescription
srcnumberPlayer server ID
itemstringItem name
metadatatableItem metadata filter (optional)

HasItem

Checks if a player has a minimum amount of an item.

local has = Bridge.Inventory.HasItem(src, item, amount)
-- Returns: boolean
ParameterTypeDescription
srcnumberPlayer server ID
itemstringItem name
amountnumberMinimum amount (optional, default 1)

CanCarryItem

Checks if a player can carry an additional amount of an item.

local canCarry = Bridge.Inventory.CanCarryItem(src, item, amount)
-- Returns: boolean
ParameterTypeDescription
srcnumberPlayer server ID
itemstringItem name
amountnumberAmount to check

GetPlayerInventory

Returns a player’s full inventory.

local inventory = Bridge.Inventory.GetPlayerInventory(src)
-- Returns: table
ParameterTypeDescription
srcnumberPlayer server ID

GetItemBySlot

Returns the item in a specific inventory slot.

local item = Bridge.Inventory.GetItemBySlot(src, slot)
-- Returns: table | nil
ParameterTypeDescription
srcnumberPlayer server ID
slotnumberSlot number

SetMetadata

Sets metadata on an item in a specific slot.

Bridge.Inventory.SetMetadata(src, slot, metadata)
ParameterTypeDescription
srcnumberPlayer server ID
slotnumberSlot number
metadatatableMetadata to set

GetItemInfo

Returns item definition data for a given item name.

local info = Bridge.Inventory.GetItemInfo(item)
-- Returns: table { name, label, weight, ... }
ParameterTypeDescription
itemstringItem name

Items

Returns a table of all registered items.

local items = Bridge.Inventory.Items()
-- Returns: table

OpenStash

Opens a stash for a player.

Bridge.Inventory.OpenStash(src, stashId, stashConfig)
ParameterTypeDescription
srcnumberPlayer server ID
stashIdstringUnique stash identifier
stashConfigtableStash configuration (slots, maxWeight, etc.)

RegisterStash

Registers a stash so it can be opened later.

Bridge.Inventory.RegisterStash(stashId, stashConfig)
ParameterTypeDescription
stashIdstringUnique stash identifier
stashConfigtableConfiguration table

ClearStash

Clears all items from a stash.

Bridge.Inventory.ClearStash(stashId)
ParameterTypeDescription
stashIdstringStash identifier

UpdatePlate

Updates the license plate associated with a vehicle stash/trunk.

Bridge.Inventory.UpdatePlate(oldPlate, newPlate)
ParameterTypeDescription
oldPlatestringOld plate text
newPlatestringNew plate text

OpenShop

Opens a shop for a player.

Bridge.Inventory.OpenShop(src, shopData)
ParameterTypeDescription
srcnumberPlayer server ID
shopDatatableShop definition data

RegisterShop

Registers a shop definition.

Bridge.Inventory.RegisterShop(shopId, shopData)
ParameterTypeDescription
shopIdstringShop identifier
shopDatatableShop definition

AddTrunkItems

Adds items to a vehicle’s trunk inventory.

Bridge.Inventory.AddTrunkItems(plate, items)
ParameterTypeDescription
platestringVehicle plate
itemstableArray of item tables

OpenPlayerInventory

Opens a player’s inventory (can open another player’s inventory).

Bridge.Inventory.OpenPlayerInventory(src, targetSrc)
ParameterTypeDescription
srcnumberPlayer server ID to open for
targetSrcnumberTarget player (optional)

GetImagePath

Returns the image path for an item.

local path = Bridge.Inventory.GetImagePath(item)
-- Returns: string
ParameterTypeDescription
itemstringItem name

StripPNG

Removes the .png extension from a string.

local stripped = Bridge.Inventory.StripPNG(str)
-- Returns: string

StripWebp

Removes the .webp extension from a string.

local stripped = Bridge.Inventory.StripWebp(str)
-- Returns: string