> For the complete documentation index, see [llms.txt](https://striga.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://striga.gitbook.io/docs/striga-inventory/qb-compatibility.md).

# QB Compatibility

What keeps working when Striga Inventory replaces qb-inventory.

Striga Inventory **provides** `qb-inventory`. qb-core and your qb scripts call `exports['qb-inventory']` as before, and Striga Inventory answers with the same names and arguments as **qb-inventory 2.2.3**.

{% hint style="warning" %}
The `qb-inventory` folder must be **out of** `resources`. If it is still there, Striga Inventory prints a red error and turns this support off.
{% endhint %}

## What keeps working

| Part                                                              | Status                                            |
| ----------------------------------------------------------------- | ------------------------------------------------- |
| qb-core load / save of player items                               | Works, same `players.inventory` format            |
| `exports['qb-inventory']` server exports                          | All 32, see below                                 |
| `exports['qb-inventory']:HasItem` (client)                        | Works                                             |
| Player methods (`Player.Functions.AddItem`...)                    | Works                                             |
| `qb-inventory:client:ItemBox` pop-up                              | Works                                             |
| `qb-inventory:client:requiredItems`                               | Works                                             |
| qb-weapons (`qb-weapons:client:UseWeapon` on use, `SetInventory`) | Works                                             |
| `inv_busy` state bag (progress bars, qb-drugs...)                 | Respected: the inventory does not open while busy |
| Old stashes / trunks / gloveboxes (`inventories` table)           | **Not moved over in 1.0.0**                       |

## Server exports

```lua
exports['qb-inventory']:AddItem(source, 'water_bottle', 1)   -- still works
```

| Group       | Exports                                                                                                                  |
| ----------- | ------------------------------------------------------------------------------------------------------------------------ |
| Load / save | `LoadInventory` `SaveInventory` `SetInventory` `SetItemData`                                                             |
| Items       | `AddItem` `RemoveItem` `UseItem` `HasItem` `GetItemCount` `CanAddItem` `GetFreeWeight` `GetTotalWeight` `ClearInventory` |
| Lookup      | `GetSlotsByItem` `GetFirstSlotByItem` `GetItemBySlot` `GetItemByName` `GetItemsByName` `GetSlots`                        |
| Inventories | `OpenInventory` `OpenInventoryById` `CloseInventory` `CreateInventory` `GetInventory` `RemoveInventory` `ClearStash`     |
| Shops       | `CreateShop` `OpenShop`                                                                                                  |
| Hooks       | `AddHook` `RemoveHook` `AddListener` `RemoveListener`                                                                    |

### Hooks and listeners

qb hook types map to Striga Inventory hook events:

| qb type           | Striga hook event |
| ----------------- | ----------------- |
| `ItemMoved`       | `move`            |
| `ItemUsed`        | `use`             |
| `ItemAdded`       | `add`             |
| `ItemRemoved`     | `remove`          |
| `InventoryOpened` | `open`            |
| `ItemBought`      | `buy`             |

`AddHook` callbacks get `{ source, item, amount, fromInventory, toInventory, reason }`. Listeners run after the action.

## Client export

```lua
local has = exports['qb-inventory']:HasItem('lockpick', 1)
```

## Player methods

These work on the QBCore player object:

`AddItem` `RemoveItem` `GetItemByName` `GetItemsByName` `GetItemBySlot` `ClearInventory` `SetInventory`

```lua
local Player = QBCore.Functions.GetPlayer(source)
Player.Functions.AddItem('water_bottle', 1)
```

## Events

| Event                               | Arguments                                            | What it does                   |
| ----------------------------------- | ---------------------------------------------------- | ------------------------------ |
| `qb-inventory:client:ItemBox`       | `itemData`, `'add'` / `'remove'` / `'use'`, `amount` | Shows the item pop-up          |
| `qb-inventory:client:requiredItems` | `items`, `show`                                      | Shows / hides the needed items |

{% hint style="info" %}
New scripts: prefer the `striga-inventory` exports. The qb-inventory names are there so old scripts keep working. See [Exports & Events](/docs/striga-inventory/exports-and-events.md).
{% endhint %}

{% content-ref url="/pages/yy0mE6nWWVGSu4FcUSAz" %}
[Exports & Events](/docs/striga-inventory/exports-and-events.md)
{% endcontent-ref %}


---

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://striga.gitbook.io/docs/striga-inventory/qb-compatibility.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
