Solved Kits claiming interfering with totems?

  • 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!

Status
Not open for further replies.

zKutari

Member
Sep 3, 2022
4
1
3
24
Explanation of what the skript should do:
- Every time someone buys something using buycraft, a permission of the set is assigned to the player.
- If a player has a permission, he can do "/kits" and then auto fill his bought kit/s.
- Only the one he bought will be displayed and working when claiming.
- Also, depending on which kit a player bought, he will either get 10, 20 or 30 totems.

Now the problem: If a player buys 2 kits, for example Kit "Bread" and kit "Apple", while "Apple" includes 10 and "Bread" includes 20 totems and he claims "Bread" using "/kits Bread", he will get the 20 totems from bread + the 10 totems from "Apple", as he has the permission "kits.permission.apple" and "kits.permission.bread".

How can I get it working that it only gives the totems of the kit the player is actually claiming? Here's my code:
Code:
command /kits <text>:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        if arg-1 is set:
            if player has permission "kits.permission.%arg-1%":
                execute console command "/ie give %arg-1%Sword %player% 1"
                execute console command "/ie give %arg-1%Axe %player% 1"
                execute console command "/ie give %arg-1%Pickaxe %player% 1"
                execute console command "/ie give %arg-1%Helmet %player% 1"
                execute console command "/ie give %arg-1%Chestplate %player% 1"
                execute console command "/ie give %arg-1%Leggings %player% 1"
                execute console command "/ie give %arg-1%Boots %player% 1"
                send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
            else:
                send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player

            if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"
            if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
on tab complete of "/kits":
    player has permission "kits.permission.zenitsu"
    add "Zenitsu" to tab completions
    player has permission "kits.permission.tomioka"
    add "Tomioka" to tab completions
    player has permission "kits.permission.mitsuri"
    add "Mitsuri" to tab completions
 
You are using 'if' every time, but need 'else if'
Code:
command /kits <text>:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        if arg-1 is set:
            if player has permission "kits.permission.%arg-1%":
                execute console command "/ie give %arg-1%Sword %player% 1"
                execute console command "/ie give %arg-1%Axe %player% 1"
                execute console command "/ie give %arg-1%Pickaxe %player% 1"
                execute console command "/ie give %arg-1%Helmet %player% 1"
                execute console command "/ie give %arg-1%Chestplate %player% 1"
                execute console command "/ie give %arg-1%Leggings %player% 1"
                execute console command "/ie give %arg-1%Boots %player% 1"
                send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player 
            else if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"
            else if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            else if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
            else:
                send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
on tab complete of "/kits":
    player has permission "kits.permission.zenitsu"
    add "Zenitsu" to tab completions
    player has permission "kits.permission.tomioka"
    add "Tomioka" to tab completions
    player has permission "kits.permission.mitsuri"
    add "Mitsuri" to tab completions
 
You are using 'if' every time, but need 'else if'
Code:
command /kits <text>:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        if arg-1 is set:
            if player has permission "kits.permission.%arg-1%":
                execute console command "/ie give %arg-1%Sword %player% 1"
                execute console command "/ie give %arg-1%Axe %player% 1"
                execute console command "/ie give %arg-1%Pickaxe %player% 1"
                execute console command "/ie give %arg-1%Helmet %player% 1"
                execute console command "/ie give %arg-1%Chestplate %player% 1"
                execute console command "/ie give %arg-1%Leggings %player% 1"
                execute console command "/ie give %arg-1%Boots %player% 1"
                send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
            else if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"
            else if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            else if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
            else:
                send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
on tab complete of "/kits":
    player has permission "kits.permission.zenitsu"
    add "Zenitsu" to tab completions
    player has permission "kits.permission.tomioka"
    add "Tomioka" to tab completions
    player has permission "kits.permission.mitsuri"
    add "Mitsuri" to tab completions
You are using 'if' every time, but need 'else if'
Code:
command /kits <text>:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        if arg-1 is set:
            if player has permission "kits.permission.%arg-1%":
                execute console command "/ie give %arg-1%Sword %player% 1"
                execute console command "/ie give %arg-1%Axe %player% 1"
                execute console command "/ie give %arg-1%Pickaxe %player% 1"
                execute console command "/ie give %arg-1%Helmet %player% 1"
                execute console command "/ie give %arg-1%Chestplate %player% 1"
                execute console command "/ie give %arg-1%Leggings %player% 1"
                execute console command "/ie give %arg-1%Boots %player% 1"
                send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
            else if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"
            else if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            else if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
            else:
                send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
on tab complete of "/kits":
    player has permission "kits.permission.zenitsu"
    add "Zenitsu" to tab completions
    player has permission "kits.permission.tomioka"
    add "Tomioka" to tab completions
    player has permission "kits.permission.mitsuri"
    add "Mitsuri" to tab completions
TYSM!
[doublepost=1662469179,1662407522][/doublepost]
You are using 'if' every time, but need 'else if'
Code:
command /kits <text>:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        if arg-1 is set:
            if player has permission "kits.permission.%arg-1%":
                execute console command "/ie give %arg-1%Sword %player% 1"
                execute console command "/ie give %arg-1%Axe %player% 1"
                execute console command "/ie give %arg-1%Pickaxe %player% 1"
                execute console command "/ie give %arg-1%Helmet %player% 1"
                execute console command "/ie give %arg-1%Chestplate %player% 1"
                execute console command "/ie give %arg-1%Leggings %player% 1"
                execute console command "/ie give %arg-1%Boots %player% 1"
                send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
            else if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"
            else if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            else if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
            else:
                send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
on tab complete of "/kits":
    player has permission "kits.permission.zenitsu"
    add "Zenitsu" to tab completions
    player has permission "kits.permission.tomioka"
    add "Tomioka" to tab completions
    player has permission "kits.permission.mitsuri"
    add "Mitsuri" to tab completions
NVM, just tried it rn and it doesnt work, just just giving me 10 totems every time, no matter which kit I choose, even tho i have all 3 perms...

here's the code:
Code:
command /kits <text>:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: &e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim a kit again!
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        if arg-1 is set:
            if player has permission "kits.permission.%arg-1%":
                execute console command "/ie give %arg-1%Sword %player% 1"
                execute console command "/ie give %arg-1%Axe %player% 1"
                execute console command "/ie give %arg-1%Pickaxe %player% 1"
                execute console command "/ie give %arg-1%Helmet %player% 1"
                execute console command "/ie give %arg-1%Chestplate %player% 1"
                execute console command "/ie give %arg-1%Leggings %player% 1"
                execute console command "/ie give %arg-1%Boots %player% 1"
                send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
            if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"
            else if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            else if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
            else:
                send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
on tab complete of "/kits":
    player has permission "kits.permission.zenitsu"
    add "Zenitsu" to tab completions
    player has permission "kits.permission.tomioka"
    add "Tomioka" to tab completions
    player has permission "kits.permission.mitsuri"
    add "Mitsuri" to tab completions
 
  • Like
Reactions: lotzy
Put check of 'totem giver' code inside kit condition
And set check permissions of totems in describe order, because when player have "zenitsu" permission, "tomioka" and "mitsuri" never executed, idk

Code:
command /kits [<text>]:
    executable by: players
    permission: kits.permission.skript
    permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    cooldown: 20 seconds
    cooldown message: &e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim a kit again!
    trigger:
        if arg-1 is not set:
            send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
        else if player has permission "kits.permission.%arg-1%":
            execute console command "/ie give %arg-1%Sword %player% 1"
            execute console command "/ie give %arg-1%Axe %player% 1"
            execute console command "/ie give %arg-1%Pickaxe %player% 1"
            execute console command "/ie give %arg-1%Helmet %player% 1"
            execute console command "/ie give %arg-1%Chestplate %player% 1"
            execute console command "/ie give %arg-1%Leggings %player% 1"
            execute console command "/ie give %arg-1%Boots %player% 1"
            
            if player has permission "kits.permission.mitsuri":
                execute console command "/give %player% totem_of_undying 30"
            else if player has permission "kits.permission.tomioka":
                execute console command "/give %player% totem_of_undying 20"
            else if player has permission "kits.permission.zenitsu":
                execute console command "/give %player% totem_of_undying 10"

            send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
        else:
            send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
 
Status
Not open for further replies.