Solved Add +1 max /home to player

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

vatum20

New Member
Dec 9, 2023
8
0
1
19
Hi,
I want to add voucher to my GUI shop that will add +1 home to max homes for player who bought it.
I already have GUI shop ready, and I have voucher that will execute command on right clicking, now I need a command. I found post on SpigotMC that says:

"You can create a simple skript with a command
/boughthome
Get player sethome permission -> split at "." -> get number part -> increment -> set permission -> remove old permission"

But as I just learnt about Skript, I have no knowledge of how to do that. I did a research and I still have no clue. I really don't want to ask for doing it for me, but I feel like Skript has such a high skill floor of doing anything that isn't: say "Hello World!", that I have to get help to get anything done.

Server is running on 1.20.2

My sethome plugin is UltimateHomes with permission for max homes: ultimatehomes.sethome.max.3

I use LuckPerms as permissions plugin.

I really need someone to assemble a script with all the crappy info I provided. If it's possible, there should be limit to max 10 sethomes. I'm really sorry for asking. But THANK YOU to anyone who is willing to help.
If you need any more info, just tell me. Again sorry for asking. It's my first time creating post on this forum.
 
Hi, very nice description of what you use and what you need, but I still have a question about how exactly you want it to work. When people buy a voucher, they get it in their inventory and when they right click on it, it increases the max /home by 1? Or when they type /boughthome does it increase it right away? I'd need to know this, then I might be able to help.
 
after they right click it, Vouchers plugin will execute command /boughthome as console.
Executing command after right click is already set up. I just lack a proper command.
 
Oh so you just need to after they right click it it will send console command "/boughthome"
In that case i need to know what block or Material is the voucher from, and name of the voucher
 
Okay, in that case your code should look like this, i made some notes for you on the side of the code, so just follow them and you should be good.
Code:
on right click with nametag: #Instead of nametag put what item is your voucher - if its nametag then let it be
    if name of tool of player is "Voucher": #To the quotes just put your name of the item on the voucher
        execute console command "boughthome"
 
I think there was a misunderstanding. I can execute command on my own. I need a command that will take permission from ultimatehomes, add 1 to max home, set the new permission for player and remove old permission.

Simplifying this, I need command /boughthome %player% to do:
/boughthome %player%
get %player% permission ultimatehomes.sethome.max.[x] (x is any number)
isolate [x] (so we can add 1 to it)
unset %player% permission ultimatehomes.sethome.max.[x]
add 1 to [x] (this creates [x+1])
set %player% permission ultimatehomes.sethome.max.[x+1]
if x > 10, cancel command and display custom error: You've reached max number of /sethomes!
 
Last edited:
Hello, sorry for the wait, i wasnt at the computer now for a while, i tried do it how you wanted, i hope its good now. :emoji_wink:
Code:
command /boughthome:
    trigger:
        loop permissions of player:
            set {_p::*} to split loop-value at "."
            if {_p::1} is "ultimatehomes":
                if {_p::2} is "sethome":
                    if {_p::3} is "max":
                        set {_p} to {_p::4} parsed as number
                        set {_n} to ({_p} +1)
                        if {_n} is not more than 10:
                            execute console command "lp user %player% permission set ultimatehomes.sethome.max.%{_n}%"
                            execute console command "lp user %player% permission unset ultimatehomes.sethome.max.%{_p::4}%"
                            send "&aYour home was successfully increased by 1!" to player
                            send "&aYou have now &e%{_n}% &ahomes!" to player
                        else:
                            send "&cYou've reached max number of /sethomes!" to player
 
what addons do you have? Or like you should Definitely have skbee
 
I got it to work. I don't have any addon and this code works perfect:

Code:
command /boughthome <player>:
    trigger:
        loop permissions of arg-1:
            set {_p::*} to split loop-value at "."
            if {_p::1} is "ultimatehomes":
                if {_p::2} is "sethome":
                    if {_p::3} is "max":
                        set {_p} to {_p::4} parsed as number
                        set {_n} to ({_p} +1)
                        if {_n} is not more than 10:
                            execute console command "lp user %player% permission set ultimatehomes.sethome.max.%{_n}%"
                            execute console command "lp user %player% permission unset ultimatehomes.sethome.max.%{_p::4}%"
                            send "&aYour home was successfully increased by 1!" to player
                            send "&aYou have now &e%{_n}% &ahomes!" to player
                        else:
                            send "&cYou've reached max number of /sethomes!" to player

Ty for your time and effort! I really appreciate it!
 
Well in that case thats somewhere with the voucher u just wanted the command which i did, its like so much things that you need to connect along. Ig i can make like custom sethome skript with things that are in UltimateHomes plugin if you want..
You know what, just add me on discord, so we dont spam here..
discord: danrub
 
Ok XD, I figured it out, I had to use %arg-1% in lp user commands. I won't bother you anymore. Ty very much for everything! I'm closing post.