> For the complete documentation index, see [llms.txt](https://docs.vames-store.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vames-store.com/assets/vms_housing/configuration-files/integration-files/inventory/server-side.md).

# Server-Side

{% tabs %}
{% tab title="ox\_inventory" %}
{% code expandable="true" %}

```lua
if Config.Inventory ~= 'ox_inventory' then
    return
end

function RegisterStorage(metadata)
    local slots = tonumber(metadata.slots)
    local weight = tonumber(metadata.weight)
    
    if not slots or not weight then
        return
    end

    exports['ox_inventory']:RegisterStash(metadata.id, 'Storage', slots, weight)
end

function RegisterUsableItem(name, cb)
    if Config.Core == "ESX" then
        Core.RegisterUsableItem(name, function(src, itemName, itemData)
            cb(src, itemName, { metadata = itemData.metadata })
        end)
    elseif Config.Core == "QB-Core" then
        Core.Functions.CreateUseableItem(name, function(src, item)
            cb(src, item.name, { metadata = item.metadata })
        end)
    end
end

function GetItem(src, xPlayer, name, data, search)
    if search == 'key' then
        return exports['ox_inventory']:GetItem(src, name, {keySerialNumber = data.keySerialNumber}, true) >= 1
    end
end

function AddItem(src, xPlayer, name, count, metadata)
    exports['ox_inventory']:AddItem(src, name, count, metadata)
end

function RemoveItem(src, xPlayer, name, count)
    exports['ox_inventory']:RemoveItem(src, name, count)
end
```

{% endcode %}
{% endtab %}

{% tab title="qb-inventory" %}
{% code expandable="true" %}

```lua
if Config.Inventory ~= 'qb-inventory' then
    return
end

function RegisterStorage(metadata)
    local slots = tonumber(metadata.slots)
    local weight = tonumber(metadata.weight)
    
    if not slots or not weight then
        return
    end

    exports['qb-inventory']:CreateInventory(metadata.id, {
        label = 'Storage',
        slots = slots,
        weight = weight,
    })
end

RegisterNetEvent('vms_housing:qb-inventory:openStorage', function(id, data)
    local src = source

    if not id or not string.find(id, "house_storage") then
        return
    end

    exports['qb-inventory']:OpenInventory(src, id, {
        maxweight = data.maxweight,
        slots = data.slots,
    })
end)

function RegisterUsableItem(name, cb)
    Core.Functions.CreateUseableItem(name, function(src, item)
        cb(src, item.name, {metadata = item.info})
    end)
end

function GetItem(src, xPlayer, name, data, search)
    if search == 'key' then
        local items = exports['qb-inventory']:GetItemsByName(src, name)
        for k, v in pairs(items) do
            if v.info and v.info.keySerialNumber == data.keySerialNumber then
                return true
            end
        end
    end
end

function AddItem(src, xPlayer, name, count, metadata)
    exports['qb-inventory']:AddItem(src, name, count, false, metadata)
end

function RemoveItem(src, xPlayer, name, count)
    exports['qb-inventory']:RemoveItem(src, name, count)
end
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.vames-store.com/assets/vms_housing/configuration-files/integration-files/inventory/server-side.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
