QB

Deleting Script

  1. If you have qb-weapons and qb-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']

SetPlayerItems, SetPlayerClotheItems and SetPlayerRealisticArmorItems

  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

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

LoadInventory Exports

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

  2. Find the "PlayerData.items = exports['qb-inventory']:LoadInventory(PlayerData.source, PlayerData.citizenid)" and replace the following code to it

PlayerData.items = {} -- tgiann-inventory sets this automatically

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


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


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