> For the complete documentation index, see [llms.txt](https://ccfivem.gitbook.io/ccfivem-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ccfivem.gitbook.io/ccfivem-docs/player-and-ui/inventory-cc_inventory.md).

# Inventory (cc\_inventory)

Standalone inventory with weight, hotbar, trunks, shops, serial-numbered weapons, crafting and an admin editor. It fully replaces `ox_inventory`.

**Frameworks:** ESX Legacy, QBCore, QBox (detected automatically). The bank account stays with the framework.

## Features

* Weight in grams, player inventory and a hotbar (slots 1–5)
* Cash and dirty money as items; one-time money import from the framework
* Trunk and glovebox sized per vehicle class or model
* Stashes, ground drops, shops with a shopping cart and a black market
* Weapons with serial numbers, durability and attachments
* Wearable clothing, body armour with plates and backpacks
* Crafting at workbenches, combining, weapon repair
* Spoilage and water damage
* Admin overlay with shop editor, item browser, custom items and image upload

{% hint style="warning" %}
cc\_inventory and `ox_inventory` must **not** run at the same time. There is no compatibility layer for third-party `exports.ox_inventory:*` calls.
{% endhint %}

{% hint style="info" %}
The code is protected by Cfx asset escrow. `config/*.lua`, `data/*.lua`, `locales/*.json`, `shared/cc_framework.lua`, `shared/cc_vehicles.lua`, `shared/cc_vehicleprops.lua` and `server/bridge.lua` stay editable.
{% endhint %}

## Works well with

* cc\_character/00%20Overview\.md) – worn clothing and wardrobe
* cc\_status/00%20Overview\.md) – food and drinks with effects
* cc\_images%20(cc\_images)/00%20Overview\.md) – item photos and photo upload in the admin overlay
* cc\_licenses/00%20Overview\.md) – licence checks in shops
* cc\_admin/00%20Overview\.md) – admin action log
* cc\_dispatch/00%20Overview\.md) – map link in the admin overlay
* cc\_lib/00%20Overview\.md) – shared notifications and dialogs

## Pages

* Installation
* Configuration
* API
* FAQ

## Installation

See also the general installation guide, dependencies and the framework bridge.

### Requirements

| Resource                               | Required | Notes                                                                                            |
| -------------------------------------- | -------- | ------------------------------------------------------------------------------------------------ |
| `oxmysql`                              | yes      | declared as `dependency`; without it the inventory is volatile and everything is lost on restart |
| `es_extended`, `qb-core` or `qbx_core` | yes      | one framework                                                                                    |
| `cc_character`                         | optional | worn clothing, wardrobe                                                                          |
| `cc_status` or `esx_status`            | optional | hunger/thirst when eating and drinking                                                           |
| `cc_lib`                               | optional | shared notifications/dialogs                                                                     |
| `cc_images`                            | optional | item photos, upload in admin overlay (SVG icons otherwise)                                       |
| `cc_licenses`                          | optional | licence check in shops                                                                           |
| `cc_admin`                             | optional | admin action log (console otherwise)                                                             |
| `cc_dispatch`                          | optional | map link in admin overlay                                                                        |

### 1. Back up

Back up your database and `server.cfg` before switching inventories.

### 2. Copy the resource

Copy the folder to `resources/[crankchaos]/cc_inventory`.

### 3. Remove the old inventory

Remove `ox_inventory` (or any other inventory) from `server.cfg`. Do not delete it, so you can go back. If `ox_inventory` is still running, cc\_inventory does not hook into the framework and says so in the console.

### 4. server.cfg

```cfg
ensure oxmysql
ensure es_extended        # or qb-core / qbx_core
ensure cc_lib             # optional
ensure cc_character       # optional, for worn clothing
ensure cc_inventory
```

### 5. ACE permissions

```cfg
add_ace group.admin cc_inventory.admin allow   # /invadmin, /werkbank
add_ace group.admin command.ccgive allow
add_ace group.admin command.cctake allow
```

The admin ACE name can be changed with `Config.Admin.ace`.

### 6. Database

No SQL file is needed. Tables create themselves on first start. Watch the server log on the first start: the first migration imports cash and black money **once** from the framework account, protected against double imports by its own marker table.

### Framework notes

The framework is detected automatically for ESX Legacy, QBCore and QBox. The bank account remains with the framework; only cash and dirty money become items.

## Configuration

{% hint style="info" %}
All weights are in **grams**, all money amounts are whole numbers. Visible texts live in `locales/de.json` and `locales/en.json`.
{% endhint %}

| File                               | Contents                                                        |
| ---------------------------------- | --------------------------------------------------------------- |
| `config/config.lua`                | language, player capacity, hotbar, saving, status values, admin |
| `config/containers.lua`            | stashes, shops, drops, keys                                     |
| `config/vehicles.lua`              | trunk/glovebox size and access per vehicle class or model       |
| `config/weapons.lua`               | durability, ammo, serial numbers, categories                    |
| `config/clothing.lua`              | equipment slots and ped components                              |
| `config/gear.lua`                  | armour plates, backpack, `/togglehair`, throw/place             |
| `config/itemrules.lua`             | container items, spoilage, water damage                         |
| `config/crafting.lua`              | recipes, workbenches, quick crafting, combining, weapon repair  |
| `config/panel.lua`                 | window look, rarity, sorting, labels                            |
| `data/items.lua`, `data/extra.lua` | item definitions                                                |
| `data/weapons.lua`                 | weapons, ammo, attachments                                      |
| `data/clothing.lua`                | items generated from the clothing config                        |

### General (`config/config.lua`)

```lua
Config.Locale = 'de'
Config.Player = { slots = 40, maxWeight = 100000 }
Config.HotbarSlots = 5
Config.GiveDistance = 3.0
Config.SaveIntervalMs = 60000
Config.SaveBatchSize = 100
Config.UnloadAfterSeconds = 600
Config.DefaultStackLimit = 0
Config.MaxSlots = 200
Config.ImagePath = 'https://cfx-nui-cc_inventory/web/dist/images/'
```

* `Config.Character` – the 3D character preview in the inventory (`enabled`, camera distance, height, fov).
* `Config.Stats` – which stats are shown (`health`, `armour`, `hunger`, `thirst`, `stamina`) and where hunger/thirst come from (`source = 'auto'`).
* `Config.Consume.rateMs` – minimum time between two uses.
* `Config.Categories` – filter tabs in the inventory.

### Admin

```lua
Config.Admin = {
    ace = 'cc_inventory.admin',
    command = 'invadmin',
    giveMax = 1000,
    givePerMinute = 30,
    rate = { open = 1000, save = 1500, give = 750, photo = 5000, pick = 500 },
}
```

### Keys (`config/containers.lua`)

```lua
Config.Keys = {
    open = 'TAB',
    secondary = 'K',                       -- nearest container
    hotbar = { '1', '2', '3', '4', '5' },  -- empty list disables the hotbar keys
    hotbarPeek = 'O',
}
```

These are defaults for new players; each player can change them in the FiveM key bindings.

### Containers (`config/containers.lua`)

* `Config.Stashes` – fixed stashes with `id`, `label`, `coords`, `slots`, `maxWeight`, `groups` (job = min grade), `blip`. `Config.StashDistance = 2.5`.
* `Config.Shops` – shops with accounts (`cash`, `bank`), blip, ped and locations. `Config.ShopDistance = 3.0`, `Config.ShopLicenseFallback`, `Config.ShopCart = { maxLines = 30, maxCount = 1000, cooldownMs = 1000 }`.
* `Config.Drops` – ground drops: `slots = 20`, `maxWeight = 100000`, `distance = 2.0`, `model`, `max = 200`.

{% hint style="warning" %}
Check shop and stash coordinates in-game before going live.
{% endhint %}

### Vehicles (`config/vehicles.lua`)

`Config.Vehicles.trunk` and `.glovebox` define slots/weight per vehicle class, e.g. `[0] = { slots = 21, maxWeight = 168000 }`. Overrides per model via `trunkModels`/`gloveboxModels`, exclusions via `noTrunk`/`noGlovebox`, front trunks via `frontTrunk`. Access: `trunkDistance`, `gloveboxDistance`, `requireOpenDoor = true`, `openLockedTrunk = false`, `serverReach`, `trustClientClass`.

### Weapons (`config/weapons.lua`)

`Config.Weapons.enabled = true`. With `false` the items stay, but equipping, reloading and attachments are disabled – for servers that manage weapons with another script.

### Gear (`config/gear.lua`)

`Config.Armor` (plates), `Config.Backpack`, `Config.Hair = { enabled = true, command = 'togglehair', key = nil }`, `Config.Throw` (throw and place items).

### Item rules (`config/itemrules.lua`)

* `Config.ItemContainers` – items that act as containers.
* `Config.Spoil` – `enabled`, `checkSeconds = 30`, per-item replacement or removal.
* `Config.Water` – water damage per item (`chance`, `replace`, `underwater`, `keepMeta`).

### Crafting (`config/crafting.lua`)

```lua
Config.Crafting = { enabled = true, distance = 2.5, maxBatch = 10, maxDurationMs = 60000, ... }
```

Recipes (`result`, `ingredients`), workbenches, combining and weapon repair are defined here. Workbenches can be moved in-game with `/werkbank <id>`.

### Look (`config/panel.lua`)

`Config.Panel`, `Config.Sort`, `Config.ItemText` and `Config.Rarity` control the window, sorting, labels and rarity colours.

## Exports, Events & Commands

### Commands and keys

| Command / key                        | Default                    | Permission                              |
| ------------------------------------ | -------------------------- | --------------------------------------- |
| Open inventory (`+ccInventory`)      | TAB                        | –                                       |
| Open nearest container (`+ccOpen`)   | K                          | –                                       |
| Hotbar slots 1–5 (`+ccHotbar1` …)    | 1–5                        | –                                       |
| Peek hotbar (`+ccHotbarPeek`)        | O                          | –                                       |
| `/togglehair`                        | no key (`Config.Hair.key`) | –                                       |
| `/aufsatz`                           | –                          | – (remove last weapon attachment)       |
| `/ccgive <id> <item> [count]`        | –                          | `command.ccgive`                        |
| `/cctake <id> <item> [count]`        | –                          | `command.cctake`                        |
| `/invadmin` (`Config.Admin.command`) | –                          | `cc_inventory.admin`                    |
| `/werkbank <id>`                     | –                          | `cc_inventory.admin` (move a workbench) |

### Inventory identifiers

`inv` is either a server ID (that player's inventory) or an identifier: `player:<identifier>`, `trunk:<plate>`, `glove:<plate>`, `stash:<name>`, `shop:<name>`, `drop:<number>`. Plates are trimmed and upper case. `metadata` is optional; without it, counting and removing ignore metadata.

### Server exports — items

| Export                                                                                                                                        | Returns                      |
| --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| `AddItem(inv, name, count, metadata?, slot?)`                                                                                                 | `ok, added` (all or nothing) |
| `RemoveItem(inv, name, count, metadata?, slot?)`                                                                                              | `boolean`                    |
| `GetItemCount(inv, name, metadata?)`                                                                                                          | `number`                     |
| `GetItem(inv, slot)`                                                                                                                          | slot or `nil`                |
| `CanCarry(inv, name, count, metadata?)`                                                                                                       | `boolean`                    |
| `Search(inv, name)`                                                                                                                           | `table`                      |
| `Clear(inv, keep?)`                                                                                                                           | `boolean`                    |
| `SetMetadata(inv, slot, metadata)`                                                                                                            | `boolean`                    |
| `View(inv)`                                                                                                                                   | –                            |
| `Move(src, from, to, count)`, `Split(src, id, slot, count)`, `Use(src, id, slot)`, `Give(src, slot, count, target)`, `Drop(src, slot, count)` | `ok, message`                |
| `Items()`                                                                                                                                     | `table`                      |
| `GetItemData(name)`                                                                                                                           | definition or `nil`          |

### Server exports — containers

| Export                                            | Notes                                                                |
| ------------------------------------------------- | -------------------------------------------------------------------- |
| `Register(id, data)`                              | returns container                                                    |
| `Open(src, id)` / `Close(src)`                    | `boolean`                                                            |
| `Get(id)`                                         | container or `nil`                                                   |
| `SetSlots(id, slots)` / `SetMaxWeight(id, grams)` | –                                                                    |
| `AddStash(entry)`                                 | `entry.id` required; `entry.personal = true` gives one per character |
| `RemoveStash(id)`                                 | runtime stashes only                                                 |
| `Drops()`                                         | list                                                                 |
| `OpenPlayerInventory(src, target)`                | `ok, message` – **no permission check**                              |
| `OpenVehicleContainer(src, kind, netId)`          | `'trunk'` / `'glovebox'`, no lock check                              |

### Server exports — money

`GetMoney(src, kind)` (`'cash'` or `'black'`), `AddMoney(src, kind, amount)`, `RemoveMoney(src, kind, amount)` → `boolean`, `CashOf(identifiers)` (read-only, also offline).

### Server exports — weapons

`GiveWeapon(inv, name, opts)` (`opts = { ammo, durability, tint, components, registered }`), `RegisterWeapon(inv, slot, holder?, identifier?)`, `GetCurrentWeapon(src)`, `DisarmPlayer(src)`, `LookupSerial(serial)` → `{ serial, item, registered_to, identifier, created }` or `nil`, `IsWeapon(name)`, `WeaponData()`.

### Server exports — clothing

`Wear(src)` (call from a thread), `RefreshWear(src)`, `WearEnabled()`, `WearLayout()`, `WearOf(identifier)`, `WearChange(src, changes, check)` → `{ ok, message }` (**no permission check**), `WearFromBag(src, pieces)` → `{ ok, done, missing, failed }`.

### Server exports — consumption and misc

`eat`, `drink`, `heal`, `smoke` – each `(src, item)`; `smoke` returns `false` without a lighter. `PhotoPlan()`.

{% hint style="danger" %}
`OpenPlayerInventory`, `OpenVehicleContainer` and `WearChange` perform no permission check – the calling script must.
{% endhint %}

### Client export

`OpenStash(id)` → `boolean`. The server checks distance, job and grade.

### Examples

```lua
-- Server
local ok = exports.cc_inventory:AddItem(source, 'water', 2)
if exports.cc_inventory:RemoveMoney(source, 'cash', 500) then
    -- paid
end
exports.cc_inventory:AddStash({ id = 'stash:mechanic', label = 'Workshop', slots = 50, maxWeight = 100000 })

-- Client
exports.cc_inventory:OpenStash('stash:mechanic')
```

### Public events

Server (`AddEventHandler`):

| Event                                                 | Payload                      |
| ----------------------------------------------------- | ---------------------------- |
| `cc_inventory:itemAdded` / `cc_inventory:itemRemoved` | `src, name, count, metadata` |
| `cc_inventory:itemUsed`                               | `src, name, slot, metadata`  |
| `cc_inventory:opened` / `cc_inventory:closed`         | `src, id`                    |
| `cc_inventory:consumed`                               | `src, kind, item`            |
| `cc_inventory:customItemChanged`                      | `name, exists`               |
| `cc:moneyChanged`                                     | `src`                        |

Client: `cc_inventory:status` (`key, value`) fires when neither `esx_status` nor `cc_status` runs.

### State bags (read)

`LocalPlayer.state.ccDown` and `ccCuffed` lock the inventory; `LocalPlayer.state.ccStatus` is read from cc\_status.

## FAQ & Troubleshooting

**The inventory does not hook into my framework.** `ox_inventory` (or another inventory) is still running. Remove it from `server.cfg` – cc\_inventory reports this in the console.

**Scripts calling `exports.ox_inventory:*` break.** There is no compatibility layer for `ox_inventory` exports. Adapt those scripts to the cc\_inventory API.

**Everything is gone after a restart.** `oxmysql` is not running. Without it the inventory works but is volatile.

**Players lost or doubled their cash after switching.** The first start imports cash and black money once from the framework account. A marker table prevents double imports – check the server log of the first start.

**Clothing is not shown on the ped.** Worn clothing requires cc\_character/00%20Overview\.md).

**Food and drinks do nothing.** Install cc\_status/00%20Overview\.md) (or `esx_status`). Without either, values are only emitted as the client event `cc_inventory:status`.

**Items show simple icons instead of photos.** Item photos come from cc\_images%20(cc\_images)/00%20Overview\.md); without it SVG icons are used.

**`/ccgive` does not work.** Add `add_ace group.admin command.ccgive allow` (and `command.cctake`). Amounts are capped at 10,000,000 per command.

**The inventory will not open.** It is locked while the player is down (`ccDown`) or cuffed (`ccCuffed`).

**How do I change the keys?** Players change them in the FiveM key bindings. `Config.Keys` only sets the defaults for new players.

Still stuck? See Support.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ccfivem.gitbook.io/ccfivem-docs/player-and-ui/inventory-cc_inventory.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
