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 qb-weapons and qb-inventory or another inventory script. delete it


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 qb-core/shared/items.lua to update the QB Shared Items data

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 sql_main.sql to your database

  2. Start tgiann-inventory and use convertqb ( server/convert.lua ) on cmd/live console

  3. If you want to automatically transfer your items file, use the convertitems command


OpenInventory Exports

In default QB, the export looks like this:

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:

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

More Examples

-- 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

Last updated