Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Money as Item #1152

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Cocodrulo
Copy link
Contributor

@Cocodrulo Cocodrulo commented Dec 9, 2024

Description

I don't know why QBCore has never include this feature widely used by RP servers. Some inventories include this feature, but I don't think it is a job for inventory, I believe it is for the core framework of the server. The only thing to take into account is that I'm using a function exported from the qb-inventory, so other inventories should adapt to this change and provide compativility.

Open to suggestions!!

Did not see this suggestion previously, but it seems this aproach this issue/suggestion: #930

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

@Cocodrulo Cocodrulo mentioned this pull request Dec 9, 2024
@Cocodrulo Cocodrulo changed the title Money as Item Feat: Money as Item Dec 9, 2024
Copy link
Contributor

@Jamie9192 Jamie9192 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the way you approached having this as a config option, defaulting to false.

The way the player.lua was implemented, Would be much better broken out to a function to prevent the repeated code.

@Cocodrulo
Copy link
Contributor Author

Like the way you approached having this as a config option, defaulting to false.

The way the player.lua was implemented, Would be much better broken out to a function to prevent the repeated code.

Done!! Thanks for the comment

@Cocodrulo Cocodrulo requested a review from Jamie9192 December 10, 2024 20:50
@itsExpress
Copy link

Curious, how does this handle negative amounting?
For example, if you have cash to allow -500, would it add money then remove it? or would it just allow you to go -500 and never recoup the costs?

@Cocodrulo
Copy link
Contributor Author

Well I think that if a server wants its money as item, they would not let that account to be in negative terms. But in case it does, it is all handled by the inventory script. It is how this resource handle it what will determine the outcome. I don't know if I have explained myself correctly. But I don't think modern inventories allow negative quantities of items.

@Cocodrulo
Copy link
Contributor Author

I have test this in my server and I've solved some errors, now works fine

@robzZ-glitch
Copy link

I tested if the infinite error is solved and the error that you couldn't put money in trunks and other inventories and they are solved everything works fine for me too.

@illusi0n003
Copy link

Works fine on my server! Great job!

@ChristianBDev
Copy link
Contributor

ChristianBDev commented Jan 23, 2025

Forgot the Item in the qb-core/shared/items.lua as well as the image in the inventory

cash = { name = 'cash', label = 'Money', weight = 0, type = 'item', image = 'money.png', unique = true, useable = false, shouldClose = false, description = 'A piece of paper that is useful' },

@Cocodrulo
Copy link
Contributor Author

Forgot the Item in the qb-core/shared/items.lua as well as the image in the inventory

cash = { name = 'cash', label = 'Money', weight = 0, type = 'item', image = 'money.png', unique = true, useable = false, shouldClose = false, description = 'A piece of paper that is useful' },

Well, since is optional and the default vale is false, I do not think that is necessary

@ChristianBDev
Copy link
Contributor

Its optional when they want cash as an item but when they want it they will be coming to the support channels wanting help with their errors since theres no item so add it in and comment out then well make a documentation on it if they want cash as an item, even having it as a item wont do anything if the check for useCashAsAnItem is true.

It's Necessary so add it in so people dont come to support asking us to fix it.

Copy link
Contributor

@ChristianBDev ChristianBDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add in the item for no future support questions to be asked for the item

cash = { name = 'cash', label = 'Money', weight = 0, type = 'item', image = 'money.png', unique = true, useable = false, shouldClose = false, description = 'A piece of paper that is useful' },

@Cocodrulo
Copy link
Contributor Author

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants