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

QB-Multicharacter

  1. Open "qb-multichar\server\main.lua" file

  2. A 2000-millisecond delay needs to be added to the GiveStarterItems function because the inventory is created shortly after the player is loaded, and since this function runs while the player is being loaded, the starter items cannot be given. To fix this, modify the function as shown below (we added a 2000-millisecond delay at the very beginning of the function).

Note: If you are using a different multichar script and it contains a similar code, make the same adjustment there as well.

local function GiveStarterItems(source)
    Wait(2000) -- Wait 2 Second
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    for _, v in pairs(QBCore.Shared.StarterItems) do
        local info = {}
        if v.item == "id_card" then
            info.citizenid = Player.PlayerData.citizenid
            info.firstname = Player.PlayerData.charinfo.firstname
            info.lastname = Player.PlayerData.charinfo.lastname
            info.birthdate = Player.PlayerData.charinfo.birthdate
            info.gender = Player.PlayerData.charinfo.gender
            info.nationality = Player.PlayerData.charinfo.nationality
        elseif v.item == "driver_license" then
            info.firstname = Player.PlayerData.charinfo.firstname
            info.lastname = Player.PlayerData.charinfo.lastname
            info.birthdate = Player.PlayerData.charinfo.birthdate
            info.type = "Class C Driver License"
        end
        exports['qb-inventory']:AddItem(src, v.item, v.amount, false, info, 'qb-multicharacter:GiveStarterItems')
    end
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

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