swkeep / keep-bags

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

keep-bags

Keep-bags

keep-bags is a script designed to enhance the inventory management experience for players. With a range of key features.

Key Features

❤️ Support Development

If you enjoy my work and would like to show your appreciation, please consider making a donation to support the ongoing development of the script. Your contribution goes a long way in helping me add more exciting features and improvements. 🚀

Thank you for your generosity and support! 🙏

Support

Preview

Check out Keep-bags preview for a better understanding of the mod's functionality.

Click HERE (Youtube)

Resource Usage

Keep-bags

Dependencies

How to Install

Follow the steps mentioned below to install keep-bags:

step 1:

step 2:

 backpack1                    = { name = "backpack1", label = "Backpack", weight = 7500, type = "item", image = "backpack1.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A stylish backpack" },
    backpack2                    = { name = "backpack2", label = "Backpack", weight = 15000, type = "item", image = "backpack2.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A stylish backpack" },
    duffle1                      = { name = "duffle1", label = "Duffle bag", weight = 15000, type = "item", image = "duffle1.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A stylish duffle bag" },
    briefcase                    = { name = "briefcase", label = "Briefcase", weight = 10000, type = "item", image = "briefcase.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A portable rectangular case used for carrying important documents, files, or other personal belongings." },
    paramedicbag                 = { name = "paramedicbag", label = "Paramedic bag", weight = 5000, type = "item", image = "paramedicbag.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A medical bag used by paramedics, containing essential supplies for emergency care." },
    policepouches                = { name = "policepouches", label = "Police Pouch", weight = 5000, type = "item", image = "policepouches.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A pouch used by police officers to store and carry essential supplies such as handcuffs, pepper spray, and other tactical equipment." },
    policepouches1               = { name = "policepouches1", label = "Police Pouch", weight = 5000, type = "item", image = "policepouches1.png", unique = true, useable = true, shouldClose = true, combinable = nil, description = "A larger version of the police pouch used to store additional tactical gear and equipment." },
    briefcaselockpicker          = { name = "briefcaselockpicker", label = "Briefcase Lockpicker", weight = 500, type = "item", image = "lockpick.png", unique = false, useable = true, shouldClose = true, combinable = nil, description = "Briefcase Lockpicker" },

ESX (ox_inventory)

["backpack1"] = {
     label = "backpack1",
     weight = 15,
     stack = false,
     close = true,
     description = "A stylish backpack"
},
["backpack2"] = {
     label = "backpack2",
     weight = 15,
     stack = false,
     close = true,
     description = "A stylish backpack"
},
["duffle1"] = {
     label = "Duffle bag",
     weight = 15,
     stack = false,
     close = true,
     description = "A stylish duffle bag"
},
["briefcase"] = {
     label = "Briefcase",
     weight = 10,
     stack = false,
     close = true,
     description = "A portable rectangular case used for carrying important documents, files, or other personal belongings."
},
["paramedicbag"] = {
     label = "Paramedic bag",
     weight = 5,
     stack = false,
     close = true,
     description = "A medical bag used by paramedics, containing essential supplies for emergency care."
},
["policepouches"] = {
     label = "Police Pouch",
     weight = 5,
     stack = false,
     close = true,
     description = "A pouch used by police officers to store and carry essential supplies such as handcuffs, pepper spray, and other tactical equipment."
},
["policepouches1"] = {
     label = "Police Pouch",
     weight = 5,
     stack = false,
     close = true,
     description = "A larger version of the police pouch used to store additional tactical gear and equipment."
},

["briefcaselockpicker"] = {
     label = "Briefcase Lockpicker",
     weight = 0.5,
     stack = true,
     close = true,
     description = "Briefcase Lockpicker"
}

Only if you're using qb-clothing

Find the openMenu function in client/main.lua and then add this event at the end of it:

local function openMenu(allowedMenus)
     -- existing code up there ...

    TriggerEvent('qb-clothing:client->open')
end

Only if you're using qb-inventory

Find the SaveStashItems() function in server/main.lua and then add this event at the end of it

TriggerEvent('keep-harmony:stash->close', stashId)

after editing the function. The modified function should look like this:

local function SaveStashItems(stashId, items)
    if Stashes[stashId].label == 'Stash-None' or not items then return end

    for _, item in pairs(items) do
        item.description = nil
    end

    MySQL.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items',
        {
            ['stash'] = stashId,
            ['items'] = json.encode(items)
        })

    Stashes[stashId].isOpen = false
    TriggerEvent('keep-harmony:stash->close', stashId) --- this is the line 
end

And then add this export at the end of server/main.lua:

exports('GetInventoryData', function(type, id)
    if type == 'stash' then
        return Stashes[id]
    end
end)