# QB Inventory

{% hint style="warning" %}
This guide is for qb-inventory version 2.x or higher. Old versions or inspired/custom inventories based on qb-inventory are NOT supported.
{% endhint %}

* Go to **qb-inventory/server/functions.lua** and add the following export after `InitializeInventory` function:

```lua
exports('registerInventory', InitializeInventory)
```

<figure><img src="/files/eRph4j9y3GavRoLQznfk" alt=""><figcaption></figcaption></figure>

* Go to **qb-inventory/server/main.lua** and add the following line inside the `qb-inventory:server:closeInventory` event:

```lua
TriggerEvent("av_scripts:inventorySaved", src, nil, inventory)
```

<figure><img src="/files/e7eTsMDgFN3YhOBE9Dci" alt=""><figcaption></figcaption></figure>

* In **qb-inventory/server/main.lua** add the following code in the end of the file:

```lua
function WipeStash(identifier)
    if Inventories and Inventories[identifier] then
        Inventories[identifier]['items'] = {}
    end
    local exists = MySQL.single.await('SELECT `items` FROM `inventories` WHERE `identifier` = ?', {
        identifier
    })
    if exists and exists['items'] then
        local empty = {}
        MySQL.update.await('UPDATE `inventories` SET `items` = ? WHERE `identifier` = ?', {
            json.encode(empty), identifier
        })
    end
end

exports('WipeStash', WipeStash)
```


---

# Agent Instructions: 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:

```
GET https://docs.av-scripts.com/guides/illegal-runs/qb-inventory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
