π¦ 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:
- Adding starter items to new characters
- 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.
-- 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#
- Install ox_inventory
- Configure for your framework
- Start before 0r-multicharacterv3
π§ qb-inventory#
-- 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#
-- 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#
-- 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#
-- 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#
server_scripts {
-- ... other scripts
'modules/inventory/my-inventory/server.lua',
}
π Starter Items Configuration#
Starter items are configured in config/config.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#
- Check inventory is started before multicharacter
- Verify the inventory name matches exactly
- Check server console for errors
Items not adding#
- Verify item names match inventory items
- Check item exists in your items table/config
- Review inventory's add item function requirements
Metadata not saving#
- Check if your inventory supports metadata
- Verify metadata format matches inventory expectations