> 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_gathering/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. The script will not work on its own until you do, it has no way to know how your inventory handles items.

## 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\_gathering calls these functions, so both must be implemented for gathering to hand out items correctly:

```lua
standalone.canCarryItem = function(source, item, amount)
    -- Implement with your own code.
    -- Must RETURN true if the player `source` can carry `amount` of `item`.
    return true
end

standalone.addItem = function(source, item, amount)
    -- Implement with your own code.
    -- Give `amount` of `item` to the player `source`.
    return false
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.canCarryItem = function(source, item, amount)
    return exports.ox_inventory:CanCarryItem(source, item, amount)
end
```
