qbcore-framework / qb-apartments

Apartment Script Used With QB-Core :house:
GNU General Public License v3.0
25 stars 197 forks source link

[SUGGESTION] Add hourly or daily rent amount for apartments #98

Closed Scottywonderful closed 2 years ago

Scottywonderful commented 2 years ago

Is your feature request related to a problem? Please describe. No, This feature request has been asked before but has not been answered or responded though those issue tickets have been closed since.

Describe the feature you'd like It'd be nice to be able to bill players a set amount per hour or day for their apartment but of course the price changing depending on location or value of the apartments.

For example, they pay 100$ an hour for renting the apartment, South Rockford Drive, though if they were to move to Tinsel Towers, rent would cost 250$ an hour or whatever amount the server owner wants to make that charge to be.

The code would be simple and may look from this

["apartment1"] = {
    name = "apartment1",
    label = "South Rockford Drive",
    coords = {
        enter = vector4(-667.02, -1105.24, 14.63, 242.32),
    },

To something like this

["apartment1"] = {
    name = "apartment1",
    label = "South Rockford Drive",
    rent = 100,
    coords = {
        enter = vector4(-667.02, -1105.24, 14.63, 242.32),
    },

On top of that, it would be that it would go off with the paycheck timer set in qb-core QBConfig.Money.PayCheckTimeOut = 15 -- The time in minutes that it will give the paycheck

or a new line be added which allows for the time to be different on payment of apartments like QBConfig.Money.BillApartment = 60 -- The time in minutes that a bill will be sent for renting the apartment they selected

If not, you could create a new line in qb-apartments which would be something along the lines of: Apartments.BillTimer = 60 -- The time in minutes that a bill will be sent for renting the apartment they selected

Describe alternatives you've considered Well I gave 2 solutions above though a complete alternative could be that all apartments cost the same and you have 2 new added lines in the config

Which the lines would look something like this:

Apartments.BillCost = 250 -- The amount that should be billed for the apartment rent when the timer below runs out Apartments.BillTimer = 60 -- The time in minutes that a bill will be sent for renting the apartment they are living in

Additional context I would maybe like to see that if the rent doesn't get paid due to a negative balance, does it allow for the money to be still drawn making the player be in the negatives and if set as false for allowing a negative balance, does this mean the payment fails and the player becomes homeless.

For example, I would put that type of option in the apartments config.lua and the lines would look something like this:

Apartments.BillTimer = 60 -- The time in minutes that a bill will be sent for renting the apartment they are living in Apartments.BillNegative = false -- true/false - Allow a negative figure when charging the player for rent Apartments.BillHomeless = true -- true/false - If a negative payment set false, does the player become homeless?

If you require more information or would like me to give more suggestions on this then please let me know.

-- NOTE: I could possibly code this myself though I would take some time to implement and ensure it works properly (I don't have time right now to do it either).

~~Edited to correct some mistakes in the code and some spelling mistakes.

TooLiveAJ commented 2 years ago

That's been done already. https://github.com/XxJxsperxX/qb-apartments

Scottywonderful commented 2 years ago

That's been done already. https://github.com/XxJxsperxX/qb-apartments

OMG, I've been looking around for this for a while, thanks for this for making it easier for all.