QB Inventory

  • Go to qb-inventory/server/functions.lua and add the following export after InitializeInventory function:

exports('registerInventory', InitializeInventory)
  • Go to qb-inventory/server/main.lua and add the following line inside the qb-inventory:server:closeInventory event:

TriggerEvent("av_scripts:inventorySaved", src, nil, inventory)
  • In qb-inventory/server/main.lua add the following code in the end of the file:

function WipeStash(identifier)
    if Inventories and Inventories[identifier] then
        Inventories[identifier]['items'] = {}
    end
    local exists = MySQL.single.await('SELECT `items` FROM `inventories` WHERE `identifier` = ?', {
        identifier
    })
    if exists and exists['items'] then
        local empty = {}
        MySQL.update.await('UPDATE `inventories` SET `items` = ? WHERE `identifier` = ?', {
            json.encode(empty), identifier
        })
    end
end

exports('WipeStash', WipeStash)

Last updated