Code Monkey home page Code Monkey logo

keep-bags's Introduction

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

  • Expanded Inventory Capacity: Players can carry more materials and items within their inventory, allowing for greater flexibility and resource management.

  • Props: The script provides realistic visuals by displaying bag props on the player's back or hands, indicating that they are equipped with a bag.

  • Blacklisted Items: A flexible option allows you to specify blacklisted items, ensuring that certain items cannot be stored in the bag. This feature helps maintain balance and prevents abuse.

  • Smooth Animation: Opening and closing animations provide an immersive and visually appealing experience when accessing the backpack. These animations enhance realism and immersion within the game.

  • Locking System: Bags can be equipped with a locking system, offering an additional layer of security for valuable items.

  • Prevents Exploits: The script actively prevents the "bag in bag" exploit, ensuring fair gameplay and maintaining the integrity of the inventory system.

❤️ 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.

Resource Usage

Keep-bags

  • i renamed the script from keep-backpack to keep-bags ;)

Dependencies

How to Install

Follow the steps mentioned below to install keep-bags:

step 1:

  • Add images inside inventoryimages to qb-inventory/html/images

step 2:

  • Add Below code to qb-core/shared/items.lua
 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)
  • done

keep-bags's People

Contributors

abdel1touimi avatar suryabhaiin avatar swkeep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keep-bags's Issues

Bag not closing throws error in cmd

image

when i restart both scripts bag open but after that it says bag is allready open

Harmony Config

`Config.MagicTouch = false
Config.use_progressbar = true
Config.language = 'en'

-- Framework and Resource settings
Config.framework = 'qb' -- [qb / esx]
Config.inventory = 'qb-inventory-legacy' -- [qb-inventory / qb-inventory-legacy / ps-inventory / ox_inventory]
Config.target = 'qb-target' -- [qb-target / ox_target]
Config.menu = 'qb-menu' -- [built-in / qb-menu / keep-menu / ox_lib]
Config.input = 'qb-input' -- [built-in / qb-input /keep-input / ox_lib]
Config.progressbar = 'qb' -- [qb / ox_lib]
Config.notification = 'qb' -- [built-in / qb / esx / ox_lib / custom
Config.emote = 'rpemotes' -- [dpemotes / rpemotes / scully_emotemenu]

-- Resource Name Mapping
-- If you are using qb-inventory with a different name for instance, if you renamed it to custom-inventory,
-- you probably need to update its name here to ensure it will work!
Config.resource_names = {
-- This is the "Resource Name" okay!
-- I saw people who are using esx set this as esx which is wrong!
-- It should be es_extended instead!
framework = 'qb-core',
inventory = 'qb-inventory',
target = 'qb-target',
menu = 'qb-menu', -- leave it empty when using built-in
input = 'qb-input' -- leave it empty when using built-in
}

-- If these are active, the built-in menu and input will take over these resources
Config.providers = {
['qb-menu'] = {
active = true,
resource_name = 'qb-menu',
},
['qb-input'] = {
active = true,
resource_name = 'qb-input',
}
}`

Bags Config

`Config.max_inventory_slots = 41

Config.clothingScript = 'illenium-appearance' -- illenium-appearance or qb-clothing oe esx (skinchanger)`

Collision when entering vehicle

Just like most weapons on back resources, back packs can sometimes cause collision issues when entering vehicles, causing it to tornado like crazy. The fix for this is simple. Add an export to remove/add bags that we can add to the event handler for entering a vehicle.

Blacklist Return Amount

Just telling you about an issue and the quick way of fixing it.

The server_main line number 95.
Player.Functions.AddItem(item.name, 1, nil, item.info)
You have it set to only return one item. If someone tries to put a stack of an item on blacklist in they will currently only get one back.

Change the 1 to item.amount like this:
Player.Functions.AddItem(item.name, item.amount, nil, item.info)
That will fix the return amount being only one and give them back the amount put into the stash that wasn't allowed to be there.

Password

Wont let me type in a password, any idea why?
image

Briefcase password?

Hi, where can we set the password for the briefcase? After I buy a briefcase, I would assume the password can be set on first use (opening) but it doesn't even open. When I set the locked = FALSE in the config, it opens. What do I need to do to set the password?

Also, can I shorten the stash ID length a bit? Typical ID looks like this:

Stash-Bag_1ae5ae27a78a16_02g273mvDV

The long ID overlaps the weight part on my inventory and doesn't look good. I assume the first part (1ae5ae27a78a16) is the player ID and the second part (02g273mvDV) is the stash ID. If I could halve each (7 chars and 5 chars), I would be happy. And, yes I know, the chances of a duplicate are greater, but I'm willing to take the chance. Please assist in where I need to go to change the player part (hash) as I've already figured out the stash ID part (RandomId(5) on line 192 in server_main)

Items go to bag when you die

Hi swkeep! i have an idea, can you make that when you die all the items you have in inventory go to a backpack and drops on the floor to be looteable?

Love your work ♥

ps-inventory issue

I am using ps-inventory and the only issue i run across on anything is having to change the exports('inventory:server: ** to TriggerEvents. The only thing we need to be this working for ps-inventory is to add a config that will use the trigger instead of exports in keep-harmony where I believe most of the inventory calls are coming from. Can you PLEASE add this to keep-harmony so that we can use your bags on ps-inventory? ty

Why Twice once is enough Please change

I think what you're doing is really good, but it doesn't have to be. And why is so much blocked? As a dev, you should have access to everything in your keep-harmony. Why twice is enough, please change

[ script:keep-harmony] ═══════════════════════════[ Database Check ]═══════════════════════════
[ script:keep-harmony] ------------------------------------------------------------------------
[ script:keep-harmony] ░██████╗░██╗░░░░░░░██╗██╗░░██╗███████╗███████╗██████╗░
[ script:keep-harmony] ██╔════╝░██║░░██╗░░██║██║░██╔╝██╔════╝██╔════╝██╔══██╗
[ script:keep-harmony] ╚█████╗░░╚██╗████╗██╔╝█████═╝░█████╗░░█████╗░░██████╔╝
[ script:keep-harmony] ░╚═══██╗░░████╔═████║░██╔═██╗░██╔══╝░░██╔══╝░░██╔═══╝░
[ script:keep-harmony] ██████╔╝░░╚██╔╝░╚██╔╝░██║░╚██╗███████╗███████╗██║░░░░░
[ script:keep-harmony] ╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░░╚═╝╚══════╝╚══════╝╚═╝░░░░░
[ script:keep-harmony] ------------------------------------------------------------------------
[ script:keep-harmony] Discord > https://discord.gg/ccMArCwrPV
[ script:keep-harmony] GitHub > https://github.com/swkeep
[ script:keep-harmony] Tebex > https://swkeep.tebex.io
[ script:keep-harmony] Resource > [keep-harmony]
[ script:keep-harmony] ------------------------------------------------------------------------

Be able to only carry one backpack at a time (enhancement)

This is more of an enhancement, but started seeing people just buying multiple backpacks so they can carry a lot more extra stuff. Was thinking of something along the lines of only being able to carry one backpack at a time, or maybe something to do with weight affecting the player? (Not even sure if this is possible, was just an idea that came to mind) :D

[FEATURE REQUEST] event hooks added for trunks/stashes

A way to prevent someone from just buying a ton of bags and slaping them in trunks would be amazing. I love this, only problem is this scenario.

Player buys bag, puts in trunk.
Player buys another bag, puts in trunk.
x3
Player goes to a mine/store fills bag
Player puts in trunk
x3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.