swkeep / keep-bags

A bag / backpacks script for fivem (esx,qbcore/qbox)
GNU General Public License v3.0
155 stars 37 forks source link

bag is already open. error. #30

Open VRSDevelopment opened 3 months ago

VRSDevelopment commented 3 months ago

need fix for this error. bag is already open.. even my bag is close and try to reopen.

XxBENSxX commented 3 months ago

yeah i had the same problem, it seems like this scripts doesnt work perfectly with the latest qbcoreframework version

swkeep commented 3 months ago

It's working but the steps of how to do it are different! This is the announcement I made in my discord:

As of now, the old qb-inventory is called qb-inventory-legacy, and the new one is just qb-inventory So, if you want to use the new inventory, set:

Config.inventory = 'qb-inventory'

And if you want to use the old inventory, set:

Config.inventory = 'qb-inventory-legacy'

And with new inventory, you have to add these two functions at the end of qb-inventory/server/functions.lua

exports('GetInventory', function (id)
    return Inventories[id]
end)

exports('SetInventoryItems', function (id, items)
    if not Inventories[id] then return end
    Inventories[id].items = items

    -- for slot, item in pairs(items) do item.description = nil end
    items = json.encode(items)
    MySQL.prepare('INSERT INTO inventories (identifier, items) VALUES (?, ?) ON DUPLICATE KEY UPDATE items = ?', { id, items, items })

    return Inventories[id].items
end)