QB

Deleting Script

  1. If you have qb-weapons script delete it

Exports

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

Note: Do not edit GetResourceStates

SetPlayerItems and SetPlayerClotheItems

  1. Open "qb-core\server\player.lua" file

  2. Find the "function self.Functions.UpdatePlayerData()" and add the following code to it

function self.Functions.SetPlayerItems(items)
    self.PlayerData.items = items
    local stateBag = Player(self.PlayerData.source).state
    stateBag:set("items", self.PlayerData.items, true)
    self.Functions.UpdatePlayerData()
end

function self.Functions.SetPlayerClotheItems(clotheItems)
    self.PlayerData.clotheItems = clotheItems
    local stateBag = Player(self.PlayerData.source).state
    stateBag:set("clotheItems", self.PlayerData.clotheItems, true)
    self.Functions.UpdatePlayerData()
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


Edit HasItem Functions

  1. Open "qb-core\client\functions.lua" file

  2. Find the "function QBCore.Functions.HasItem(items, amount)" and replace it with the following code

function QBCore.Functions.HasItem(items, amount)
    return exports['tgiann-inventory']:HasItem(items, amount)
end
  1. Open "qb-core\server\functions.lua" file

  2. Find the "function QBCore.Functions.HasItem(source, items, amount)" and replace it with the following code

function QBCore.Functions.HasItem(source, items, amount)
    return exports['tgiann-inventory']:HasItem(source, items, amount)
end

Item List

Take a backup before replacing the item file with yours!

  1. Enter the "qb-core/shared" folder

  2. Download the following item list and put it in the qb-core/shared directory

  1. Edit the new file as you wish


qb-shops

I edited qb-shops according to the inventory! Please check config for necessary explanations

Start the script after inventory!


qb-policejob

Don't forget to add the shop config for police in tgiann-inventory\configs\shopConfig.lua

example

['police'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},

  • Open "qb-policejob\client\job.lua" file

  • Find the "RegisterNetEvent('qb-police:client:openArmoury', function()" event and replace it with the following

RegisterNetEvent('qb-police:client:openArmoury', function()
    TriggerServerEvent("inventory:server:OpenInventory", "shop", "police", "police")
end)

qb-ambulancejob

Don't forget to add the shop config for hospital in tgiann-inventory\configs\shopConfig.lua

example

['hospital'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},

  • Open "qb-ambulancejob\client\job.lua" file

  • Find the "RegisterNetEvent('qb-ambulancejob:armory', function()" event and replace it with the following

RegisterNetEvent('qb-ambulancejob:armory', function()
    if onDuty then
        TriggerServerEvent('inventory:server:OpenInventory', 'shop', 'hospital', 'hospital')
    end
end)

qb-mechanicjob

Don't forget to add the shop config for mechanic, mechanic2, mechanic3, bennys and beeker in tgiann-inventory\configs\shopConfig.lua

example

['mechanic'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},
['mechanic2'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},
['mechanic3'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},
['bennys'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},
['beeker'] = {
    {name = 'diving_gear', price = 2500, amount = 10,type = 'item'},
    {name = 'jerry_can'  , price = 200 , amount = 50,type = 'item'},
},

  • Open "qb-mechanicjob\client\main.lua" file

  • Find the "exports['qb-target']:AddCircleZone(k .. '_shop', v.shop, 0.5, {" export and replace it with the following

exports['qb-target']:AddCircleZone(k .. '_shop', v.shop, 0.5, {
    name = k .. '_shop',
    debugPoly = false,
    useZ = true
}, {
    options = { {
        label = Lang:t('target.shop'),
        icon = 'fas fa-cart-shopping',
        job = v.managed and k or nil,
        action = function()
            TriggerServerEvent('inventory:server:OpenInventory', 'shop', k .. '_shop', k .. '_shop')
        end
    } },
    distance = 2.0
})

Last updated