Inventory — Server
Functions
AddItem
Adds an item to a player’s inventory.
Bridge.Inventory.AddItem(src, item, amount, metadata, slot)| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| item | string | Item name |
| amount | number | Amount to add |
| metadata | table | Item metadata (optional) |
| slot | number | Target slot (optional) |
RemoveItem
Removes an item from a player’s inventory.
Bridge.Inventory.RemoveItem(src, item, amount, metadata, slot)| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| item | string | Item name |
| amount | number | Amount to remove |
| metadata | table | Item metadata (optional) |
| slot | number | Slot 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| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| item | string | Item name |
| metadata | table | Item 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| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| item | string | Item name |
| amount | number | Minimum 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| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| item | string | Item name |
| amount | number | Amount to check |
GetPlayerInventory
Returns a player’s full inventory.
local inventory = Bridge.Inventory.GetPlayerInventory(src)
-- Returns: table| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
GetItemBySlot
Returns the item in a specific inventory slot.
local item = Bridge.Inventory.GetItemBySlot(src, slot)
-- Returns: table | nil| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| slot | number | Slot number |
SetMetadata
Sets metadata on an item in a specific slot.
Bridge.Inventory.SetMetadata(src, slot, metadata)| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| slot | number | Slot number |
| metadata | table | Metadata to set |
GetItemInfo
Returns item definition data for a given item name.
local info = Bridge.Inventory.GetItemInfo(item)
-- Returns: table { name, label, weight, ... }| Parameter | Type | Description |
|---|---|---|
| item | string | Item name |
Items
Returns a table of all registered items.
local items = Bridge.Inventory.Items()
-- Returns: tableOpenStash
Opens a stash for a player.
Bridge.Inventory.OpenStash(src, stashId, stashConfig)| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| stashId | string | Unique stash identifier |
| stashConfig | table | Stash configuration (slots, maxWeight, etc.) |
RegisterStash
Registers a stash so it can be opened later.
Bridge.Inventory.RegisterStash(stashId, stashConfig)| Parameter | Type | Description |
|---|---|---|
| stashId | string | Unique stash identifier |
| stashConfig | table | Configuration table |
ClearStash
Clears all items from a stash.
Bridge.Inventory.ClearStash(stashId)| Parameter | Type | Description |
|---|---|---|
| stashId | string | Stash identifier |
UpdatePlate
Updates the license plate associated with a vehicle stash/trunk.
Bridge.Inventory.UpdatePlate(oldPlate, newPlate)| Parameter | Type | Description |
|---|---|---|
| oldPlate | string | Old plate text |
| newPlate | string | New plate text |
OpenShop
Opens a shop for a player.
Bridge.Inventory.OpenShop(src, shopData)| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID |
| shopData | table | Shop definition data |
RegisterShop
Registers a shop definition.
Bridge.Inventory.RegisterShop(shopId, shopData)| Parameter | Type | Description |
|---|---|---|
| shopId | string | Shop identifier |
| shopData | table | Shop definition |
AddTrunkItems
Adds items to a vehicle’s trunk inventory.
Bridge.Inventory.AddTrunkItems(plate, items)| Parameter | Type | Description |
|---|---|---|
| plate | string | Vehicle plate |
| items | table | Array of item tables |
OpenPlayerInventory
Opens a player’s inventory (can open another player’s inventory).
Bridge.Inventory.OpenPlayerInventory(src, targetSrc)| Parameter | Type | Description |
|---|---|---|
| src | number | Player server ID to open for |
| targetSrc | number | Target player (optional) |
GetImagePath
Returns the image path for an item.
local path = Bridge.Inventory.GetImagePath(item)
-- Returns: string| Parameter | Type | Description |
|---|---|---|
| item | string | Item name |
StripPNG
Removes the .png extension from a string.
local stripped = Bridge.Inventory.StripPNG(str)
-- Returns: stringStripWebp
Removes the .webp extension from a string.
local stripped = Bridge.Inventory.StripWebp(str)
-- Returns: string