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

FilePurpose
config.luaGeneral settings, optional systems, extra inventories and appearance.
data/items.luaRegular item definitions.
data/containers.luaBackpacks, wallets, fixed stashes and item-based loot.
data/shops.luaShop products, prices and locations.
data/vehicles.luaVehicle class storage settings.
data/vehicle_models.luaVehicle model class information.
data/crafting.luaCrafting recipes.
data/weapons.luaWeapons and ammunition.
data/attachments.luaAttachments, finishes and tints.
data/clothing.luaClothing items and equipment slots.

Restart the resource after editing these files.

Player inventory

Config.PlayerDefaults = {
    useNamePrefix = true,
    label = 'Inventory',
    size = { x = 8, y = 10 },
}
  • x is the number of columns.
  • y is 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

OptionPurpose
labelDefault display name.
descriptionText shown in item details.
categoryItem category stored in the definition.
imageImage filename inside web/images.
sizeGrid space occupied by the item.
weightWeight of one item, in grams.
stackWhether matching items can stack.
stackSizeMaximum amount in one stack.
useableWhether the item can be used.
shouldCloseWhether normal use closes the inventory.
throwableWhether Take to hand is available.
throwModelModel used when holding and throwing a regular item.
metadataDefault 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 = true gives everyone the same stash.
  • shared = false gives each character separate contents.
  • target = true uses the configured target system.
  • openWhenNearby = true includes the stash when pressing TAB nearby.
  • distance controls 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:

  • buy allows players to buy from the shop.
  • sell allows players to sell to the shop.
  • Omit sellPrice to prevent selling that product.
  • Omit buyPrice for a sell-only product.
  • amount = false means 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.
  • time is in seconds.
  • output is 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,
}
SettingPurpose
fillTimeMilliseconds from empty to full power.
drainTimeMilliseconds from full power to empty.
idleTimeoutMilliseconds before clearing an idle hand.
chargeTimeoutMaximum milliseconds holding R.
tapTimeShort presses within this time drop near the player's feet.
minPowerMinimum throw power.
maxPowerMaximum throw power.
speedThrow velocity at power 1.
liftUpward lift at power 1.
maxDistanceMaximum 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

SettingWhen enabled
Config.EnableWeaponSystemManages weapon equipment, ammunition and reloading.
Config.EnableClothingSystemApplies clothing through inventory items and slots.
Config.MoneyAsItemSynchronises carried cash items with the player's cash account.
Config.DynamicContainerWeightIncludes carried container contents in the player's carried weight.
Config.UseItemsFromContainersAllows normal use from containers the player carries.
Config.CleanUpEmptyInventoriesRemoves 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.