# QB

## Starting Order

To avoid issues with your other scripts, make sure to start this script **after your framework** and **before any of your scripts that use the inventory**. Otherwise, you may encounter problems with inventory-dependent scripts.

```
ensure ox_lib
ensure qb-core
ensure tgiann-inventory
ensure ...
```

***

## Deleting Script

1. If you have <mark style="color:yellow;">qb-weapons</mark> and <mark style="color:yellow;">qb-inventory</mark> or another inventory script. delete it&#x20;

***

## Exports

Search for `exports['qb-inventory']` and `exports["qb-inventory"]` in all your scripts, and replace them with `exports['tgiann-inventory']`

***

## New itemList Event

1. Add this event to the bottom of <mark style="color:yellow;">qb-core/shared/items.lua</mark> to update the QB Shared Items data

```lua
TriggerEvent("__cfx_export_tgiann-inventory_Items", function(ref)
    if not ref then return end
    QBShared.Items = ref()
end)

AddEventHandler("tgiann-inventory:itemList", function(items)
    QBShared.Items = items
end)
```

***

## Convert QB Inventory Data to TGIANN Inventory Data

1. Upload <mark style="color:yellow;">sql\_main.sql</mark> to your database
2. Start tgiann-inventory and use <mark style="color:yellow;">convertqb (</mark> [server-convert.lua](../../editable-files/server-convert.lua "mention") <mark style="color:yellow;">)</mark> on cmd/live console
3. If you want to automatically transfer your items file, use the <mark style="color:yellow;">convertitems</mark> command

***

## OpenInventory Exports

In default QB, the export looks like this:

```lua
exports['qb-inventory']:OpenInventory(src, 'policetrash', { 
    maxweight = 4000000,
    slots = 300,
})
```

You need to modify these exports as follows: Add the `"stash"` value after the player's ID (`src`, `source`, etc.). Here's the updated example:

```lua
exports['tgiann-inventory']:OpenInventory(src, "stash", "policetrash", { 
    maxweight = 4000000,
    slots = 300,
})
```

#### More Examples

```lua
-- Example 1
-- Old
exports['qb-inventory']:OpenInventory(src, stashName)
-- New
exports['tgiann-inventory']:OpenInventory(src, "stash", stashName)

-- Example 2
-- Old
exports['qb-inventory']:OpenInventory(src, currentEvidence, {
    maxweight = 4000000,
    slots = 500,
})
-- New
exports['tgiann-inventory']:OpenInventory(src, "stash", currentEvidence, {
    maxweight = 4000000,
    slots = 500,
})
```

#### More Info

\- [Stash event and exports](https://docs.tgiann.com/scripts/tgiann-inventory/events/server#stash)

