> For the complete documentation index, see [llms.txt](https://5scripts-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://5scripts-1.gitbook.io/docs/assets/5s_zombies/custom-inventory.md).

# Custom Inventory

{% hint style="info" %}
**Supported inventories**

5s\_lib already supports these out of the box. Set yours in the [5s\_lib config](/docs/assets/5s_lib/config.md) and skip this page:

`ox_inventory`, `qs-inventory`, `qb-inventory`, `tgiann-inventory`, `core_inventory`, `basic-framework`

Only follow this page if your inventory is **not** on that list.
{% endhint %}

If your server runs an inventory that 5s\_lib does not support out of the box, you can wire it up yourself through the standalone bridge.

## 1. Select the standalone bridge

In `5s_lib/config.lua` set the inventory to `standalone`:

```lua
Config.inventory = "standalone"
```

By default every standalone function is a stub that returns a safe value and prints a `not implemented` warning, so nothing works until you fill them in.

## 2. Implement the functions

File: `5s_lib/resource/bridge/inventory/standalone/server.lua`

5s\_zombies calls these functions for loot. Loot either goes straight to the player (`Config.lootMode = "instant"`) or into a stash the player opens (`Config.lootMode = "interact"`), so all of them must be implemented:

```lua
standalone.addItem = function(source, item, amount)
    -- Give `amount` of `item` to the player `source`.
end

standalone.registerStash = function(stashId, label, slots, weight)
    -- Create/register a stash identified by `stashId`.
end

standalone.addStashItem = function(stashId, itemName, count, metadata)
    -- Add an item to the stash `stashId`.
end

standalone.openStash = function(source, stashId)
    -- Open the stash `stashId` for the player `source`.
end

standalone.clearStash = function(stashId)
    -- Empty the stash `stashId`.
end
```

## Reference: ox\_inventory

For comparison, here is how the same functions are implemented for ox\_inventory in `5s_lib/resource/bridge/inventory/ox/server.lua`:

```lua
ox.addItem = function(source, item, amount)
    exports.ox_inventory:AddItem(source, item, amount)
end

ox.registerStash = function(stashId, label, slots, weight)
    exports.ox_inventory:RegisterStash(stashId, label, slots, weight, nil)
end

ox.addStashItem = function(stashId, itemName, count, metadata)
    exports.ox_inventory:AddItem(stashId, itemName, count, metadata)
end

ox.openStash = function(source, stashId)
    exports.ox_inventory:forceOpenInventory(source, "stash", stashId)
end

ox.clearStash = function(stashId)
    exports.ox_inventory:ClearInventory(stashId)
end
```
