# Supported Inventories

### 📦 Inventory Compatibility

| Inventory         | Supported | Tested |
| ----------------- | --------- | ------ |
| ox\_inventory     | ✅         | ✅      |
| qb-inventory      | ✅         | ✅      |
| ps-inventory      | ✅         | ❌      |
| qs-inventory      | ✅         | ❌      |
| codem-inventory   | ✅         | ❌      |
| origen\_inventory | ✅         | ❌      |
| core\_inventory   | ✅         | ❌      |
| tgiann-inventory  | ✅         | ❌      |
| jpr-inventory     | ✅         | ❌      |

***

### ⚙️ How It Works

The script automatically detects your inventory and uses the appropriate exports for:

1. **Adding starter items** to new characters
2. **Managing inventory** data during character switching

***

### 📁 Module Location

Inventory modules are located in:

```
modules/inventory/{inventory-name}/server.lua
```

Each module exports:

* `Inventory.AddItem(source, item, amount, slot, metadata)`

***

### 🔧 ox\_inventory

**Recommended inventory for all frameworks.**

```lua
-- modules/inventory/ox_inventory/server.lua
if GetResourceState('ox_inventory') ~= 'started' then return end

Inventory = {}

Inventory.AddItem = function(source, item, amount, slot, metadata)
    exports.ox_inventory:AddItem(source, item, amount, metadata, slot)
end
```

#### Setup

1. Install ox\_inventory
2. Configure for your framework
3. Start before 0r-multicharacterv3

***

### 🔧 qb-inventory

```lua
-- modules/inventory/qb-inventory/server.lua
if GetResourceState('qb-inventory') ~= 'started' then return end

Inventory = {}

Inventory.AddItem = function(source, item, amount, slot, metadata)
    exports['qb-inventory']:AddItem(source, item, amount, slot, metadata)
end
```

***

### 🔧 ps-inventory

```lua
-- modules/inventory/ps-inventory/server.lua
if GetResourceState('ps-inventory') ~= 'started' then return end

Inventory = {}

Inventory.AddItem = function(source, item, amount, slot, metadata)
    exports['ps-inventory']:AddItem(source, item, amount, slot, metadata)
end
```

***

### 🔧 qs-inventory

```lua
-- modules/inventory/qs-inventory/server.lua
if GetResourceState('qs-inventory') ~= 'started' then return end

Inventory = {}

Inventory.AddItem = function(source, item, amount, slot, metadata)
    exports['qs-inventory']:AddItem(source, item, amount, slot, metadata)
end
```

***

### ➕ Adding Custom Inventory Support

If your inventory isn't supported, create a module:

#### Step 1: Create Module Folder

```
modules/inventory/my-inventory/server.lua
```

#### Step 2: Create Module Code

```lua
-- Check if your inventory is running
if GetResourceState('my-inventory') ~= 'started' then return end

Inventory = {}

-- Implement the AddItem function
Inventory.AddItem = function(source, item, amount, slot, metadata)
    -- Call your inventory's add item function
    exports['my-inventory']:AddItem(source, item, amount, slot, metadata)
    -- or
    -- TriggerEvent('my-inventory:addItem', source, item, amount)
end
```

#### Step 3: Add to fxmanifest.lua

```lua
server_scripts {
    -- ... other scripts
    'modules/inventory/my-inventory/server.lua',
}
```

***

### 📋 Starter Items Configuration

Starter items are configured in `config/config.lua`:

```lua
Config.StarterItems = {
    { name = 'phone', amount = 1 },
    { name = 'id_card', amount = 1, customExport = false },
    { name = 'driver_license', amount = 1, customExport = false },
    { name = 'bread', amount = 5 },
    { name = 'water', amount = 5 },
}
```

***

### ❓ Troubleshooting

#### "Inventory not detected" error

1. Check inventory is started before multicharacter
2. Verify the inventory name matches exactly
3. Check server console for errors

#### Items not adding

1. Verify item names match inventory items
2. Check item exists in your items table/config
3. Review inventory's add item function requirements

#### Metadata not saving

1. Check if your inventory supports metadata
2. Verify metadata format matches inventory expectations
