[FREE][QB] Self-Cleaning, Generic Bags

Hey folks! I’ve finally got around to releasing this resource!

pc-bags

Is a self-cleaning, generic bag resource for qb-core. It supports the creation of bags with

  • Custom weights
  • Custom slots
  • An expiration time

Self-cleaning

This resource periodically checks all items in

  • Player inventories
  • Gloveboxes (player-owned)
  • Stashes
  • Trunks (player-owned)

For the following conditions

  • Expiration
  • An orphaned state (stash entry exists, but bag item does not)
  • Self-containment (bag was placed into itself.)

All of this helps remove unnecessary entries in your database’s stash table.

Dependencies

This resource requires rpemotes to run. If you are using an alternative, I would recommend manually tweaking the export calls in the client/main.lua file of this resource.

Config

All configuration is done through the server/config.lua file.

Installation

Due to the self-cleaning nature of this resource, it will delete items from your database. It is not a bad idea to back up your database prior to installation, however, this resource should only target the bags specified in its config.

To install pc-bags:

  • Place the latest release into the resources folder
  • Copy any custom item images from html/images into your inventory resource’s html/images
  • Add custom item entries into qb-core/shared/items.lua
  • Ensure pc-bags

Known limitations

Currently the bag animations will only play for a specified duration of time upon opening the bag. Ideally these props / animations would continue until the player closes the inventory, however, I have have to do more research on the feasibility of this.

3 Likes

Really appreciate that you added the known limitations. Good job mate!

1 Like

do u have a video of this

Unfortunately not :confused: It’s operation is pretty straightforward, however. You basically can add any bag you can make an image for - by default this just comes with a duffle bag that never expires.

It could be used for things like food trays / bags that should expire after a short duration rather than be commonly abused to hold 1000 kgs of stones.

I have updated this resource to 0.0.2!

This resource now comes with

  • Backpack
  • Box (expires after 4 hours by default)
  • Burger Shot bag (expires after 1 hour by default)
  • Duffle bag

This version also includes a small fix

  • Make client only call emote if set up for bag type

Feel free to grab the source code of the latest release on GitHub!

After some investigation, I am not seeing a good way to make bag animations stop once their stash is closed by the inventory system. Both qb-inventory and lj-inventory seem to use a NUI callback (CloseInventory) for handling the majority of the closing logic - this is not capturable outside of those resources. Theoretically one could modify the NUI callback to call a generic closing event and modify pc-bags accordingly, however, I will not be formally suggesting this as a solution as “supporting” a resource (like qb-inventory or lj-inventory) should never involve modifying it :blue_heart:

Should these inventory systems expose the proper inventory closure event and utilize it (not to be confused with qb-inventory:client:closeinv), then I would gladly add native support for this.

I am not sure if qs-inventory exposes such an event :thinking: If anyone has qs-inventory, has this info, and would like me to support this for qs-inventory then I would not mind doing so. But, chances are that you are already using their built-in bag support.

In the future I’d like to keep adding more default bag types / more fully represent the rpemotes prop selection.

I have updated this resource to 0.0.3!

This resource now comes with

  • Backpack
  • Box (expires after 4 hours by default)
  • Burger Shot bag (expires after 1 hour by default)
  • Cluckin’ Bell bag (expires after 1 hour by default)
  • Designer bag
  • Duffle bag
  • Garbage bag (expires after 1 hour by default)
  • Gun case
  • Medical bag

I have also tweaked the Burger Shot bag image to have the same style as the new Cluckin’ Bell bag.


What’s wrong with this?
This happens as soon as I put something in. If I don’t put something in, there is no error.

Odd that it doesn’t error every time, but the SQL error seems to indicate that your MariaDB database doesn’t have the json_table function. This function was added in 10.6, so I suspect that your MariaDB database is not on the latest release.

ok thanks i update the SQL

its not for ESX?:frowning: