qb-inventory

These modifications can only be made if you use the qb-inventory

Add the following to the end of the qb-inventory/server/main.lua file

exports("GetStash", function(stashId)
    return Stashes[stashId] or {
        items = GetStashItems(stashId)
    }
end)

exports('GetStashItems', GetStashItems)

RegisterServerEvent('qb-inventory:server:SaveStashItems', function(stashId, items)
    MySQL.insert('INSERT INTO stashitems (stash, items) VALUES (@stash, @items) ON DUPLICATE KEY UPDATE items = @items', {
        ['@stash'] = stashId,
        ['@items'] = json.encode(items)
    })

    if Stashes[stashId] then
        Stashes[stashId].items = items
    end
end)

Last updated