Inventory
Configuration
QBCore, Qbox, ESX, OX
Configuration
Most general settings are in config.lua. Item definitions, shops, containers and equipment have separate files.
Configuration files
| File | Purpose |
|---|---|
config.lua | General settings, optional systems, extra inventories and appearance. |
data/items.lua | Regular item definitions. |
data/containers.lua | Backpacks, wallets, fixed stashes and item-based loot. |
data/shops.lua | Shop products, prices and locations. |
data/vehicles.lua | Vehicle class storage settings. |
data/vehicle_models.lua | Vehicle model class information. |
data/crafting.lua | Crafting recipes. |
data/weapons.lua | Weapons and ammunition. |
data/attachments.lua | Attachments, finishes and tints. |
data/clothing.lua | Clothing items and equipment slots. |
Restart the resource after editing these files.
Player inventory
Config.PlayerDefaults = {
useNamePrefix = true,
label = 'Inventory',
size = { x = 8, y = 10 },
}
xis the number of columns.yis the number of rows.- Item weights and weight limits use grams.
- Existing inventories can be resized through exports.
Item definitions
Add items inside the existing itemDefinitions table in data/items.lua.
example_item = {
label = 'Example Item',
description = 'A description of the item.',
category = 'misc',
image = 'example_item.png',
size = { x = 1, y = 2 },
weight = 250,
stack = true,
stackSize = 20,
useable = true,
shouldClose = true,
throwable = true,
throwModel = 'prop_cs_cardbox_01',
metadata = {},
},
Put the image in web/images.
Values omitted from an item inherit Config.ItemDefaults.
Item options
| Option | Purpose |
|---|---|
label | Default display name. |
description | Text shown in item details. |
category | Item category stored in the definition. |
image | Image filename inside web/images. |
size | Grid space occupied by the item. |
weight | Weight of one item, in grams. |
stack | Whether matching items can stack. |
stackSize | Maximum amount in one stack. |
useable | Whether the item can be used. |
shouldClose | Whether normal use closes the inventory. |
throwable | Whether Take to hand is available. |
throwModel | Model used when holding and throwing a regular item. |
metadata | Default metadata for newly created items. |
Setting useable = true does not create an item effect. Register the effect through a server export or your item-use script.
Weapons automatically use their native weapon models.
Metadata and labels
Items and inventories have separate metadata.
An item's metadata.label overrides its default display name:
{
label = "Jack's Box",
rarity = 'rare',
}
Use SetItemLabel or SetInventoryLabel to rename an existing instance without replacing its other metadata.
Visible metadata
Choose which metadata appears in item details:
Config.VisibleItemMetadata = {
durability = {
label = 'Durability',
progress = true,
},
rarity = {
label = 'Rarity',
},
}
Progress bars use values from 0 to 100.
Rarity
Config.Rarity = {
enable = true,
tiers = {
common = '#aeb6bf',
uncommon = '#53bb76',
rare = '#51a7df',
epic = '#b778df',
legendary = '#e8bc50',
},
}
Set an item's metadata to a matching rarity name:
metadata = {
rarity = 'rare',
}
Carried containers
Define container types in data/containers.lua.
backpack = {
label = 'Backpack',
size = { x = 8, y = 8 },
blacklist = { 'backpack' },
metadata = {},
},
Link the item definition to that container:
container = 'backpack',
stack = false,
shouldClose = false,
Use either a whitelist or a blacklist for item restrictions.
Fixed stashes
Add an entry with coordinates to TSSContainers in data/containers.lua:
business_storage = {
label = 'Business Storage',
size = { x = 8, y = 6 },
coords = vector3(760.24, 1280.56, 360.3),
distance = 2.0,
shared = true,
target = false,
openWhenNearby = true,
metadata = {},
},
shared = truegives everyone the same stash.shared = falsegives each character separate contents.target = trueuses the configured target system.openWhenNearby = trueincludes the stash when pressing TAB nearby.distancecontrols access distance.
Configure nearby stash markers separately:
Config.FixedStash = {
Marker = 2,
drawDistance = 5.0,
}
Set Marker = nil to disable markers. Stashes using targets do not draw markers.
Extra inventories
Extra inventories open alongside the player's main inventory.
Config.ExtraInventories = {
backpack_slot = {
label = 'Backpack',
size = { x = 2, y = 3 },
whitelist = { 'backpack' },
},
}
Extra inventories can also be created and managed through server exports.
Shops
Edit products and locations in data/shops.lua.
A shop definition can use:
example_shop = {
label = 'Trade Counter',
coords = vector4(24.47, -1346.62, 28.50, 266.0),
pedModel = 'ig_bankman',
distance = 3.0,
size = { x = 8 },
account = 'cash',
buy = true,
sell = true,
stock = {
plastic = {
buyPrice = 5,
sellPrice = 2,
amount = 100,
},
bandage = {
buyPrice = 10,
amount = false,
},
aluminum = {
sellPrice = 3,
},
},
},
Directions are from the player's perspective:
buyallows players to buy from the shop.sellallows players to sell to the shop.- Omit
sellPriceto prevent selling that product. - Omit
buyPricefor a sell-only product. amount = falsemeans unlimited stock.- Prices are per item.
Shop height is calculated automatically from the products, with a minimum of two rows.
Crafting
Add recipes inside craftingRecipes in data/crafting.lua.
The recipe name is the output item:
radio = {
input = {
plastic = 1,
bandage = 2,
},
time = 2,
output = 1,
},
- Recipes use two unique ingredients.
- Each ingredient can require multiple items.
timeis in seconds.outputis the number of items produced.
Players craft by dragging one ingredient onto the other. ESC cancels crafting.
Throwing
Config.Throwing = {
fillTime = 500,
drainTime = 500,
idleTimeout = 5000,
chargeTimeout = 6800,
tapTime = 150,
minPower = 0.0,
maxPower = 2.0,
speed = 13.0,
lift = 3.5,
maxDistance = 70.0,
}
| Setting | Purpose |
|---|---|
fillTime | Milliseconds from empty to full power. |
drainTime | Milliseconds from full power to empty. |
idleTimeout | Milliseconds before clearing an idle hand. |
chargeTimeout | Maximum milliseconds holding R. |
tapTime | Short presses within this time drop near the player's feet. |
minPower | Minimum throw power. |
maxPower | Maximum throw power. |
speed | Throw velocity at power 1. |
lift | Upward lift at power 1. |
maxDistance | Maximum permitted landing distance at full power, in metres. |
Lower fill and drain times make the meter move faster.
Power 1 matches the original throw. Power 2 gives roughly twice its range.
Set either timeout to 0 to disable that timeout.
Optional systems
| Setting | When enabled |
|---|---|
Config.EnableWeaponSystem | Manages weapon equipment, ammunition and reloading. |
Config.EnableClothingSystem | Applies clothing through inventory items and slots. |
Config.MoneyAsItem | Synchronises carried cash items with the player's cash account. |
Config.DynamicContainerWeight | Includes carried container contents in the player's carried weight. |
Config.UseItemsFromContainers | Allows normal use from containers the player carries. |
Config.CleanUpEmptyInventories | Removes empty non-player inventories from the database during startup cleanup. |
With cash items enabled, moving cash between your main inventory and a carried backpack does not change your balance. Moving it outside your carried storage removes that cash from your account.
World drops
Configure world drops through Config.WorldDrops.
Drops and their contents are temporary and never save to the database.
When Config.WorldDrops.enable is false, ordinary dropping deletes the items instead of creating a collectible drop. Throwing is disabled.