1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Kits claiming interfering with totems?

Discussion in 'Skript' started by zKutari, Sep 5, 2022.

Thread Status:
Not open for further replies.
  1. zKutari

    zKutari Member

    Joined:
    Sep 3, 2022
    Messages:
    4
    Likes Received:
    1
    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 (Text):
    1. command /kits <text>:
    2.     executable by: players
    3.     permission: kits.permission.skript
    4.     permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    5.     cooldown: 20 seconds
    6.     cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    7.     trigger:
    8.         if arg-1 is not set:
    9.             send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
    10.         if arg-1 is set:
    11.             if player has permission "kits.permission.%arg-1%":
    12.                 execute console command "/ie give %arg-1%Sword %player% 1"
    13.                 execute console command "/ie give %arg-1%Axe %player% 1"
    14.                 execute console command "/ie give %arg-1%Pickaxe %player% 1"
    15.                 execute console command "/ie give %arg-1%Helmet %player% 1"
    16.                 execute console command "/ie give %arg-1%Chestplate %player% 1"
    17.                 execute console command "/ie give %arg-1%Leggings %player% 1"
    18.                 execute console command "/ie give %arg-1%Boots %player% 1"
    19.                 send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
    20.             else:
    21.                 send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
    22.  
    23.             if player has permission "kits.permission.zenitsu":
    24.                 execute console command "/give %player% totem_of_undying 10"
    25.             if player has permission "kits.permission.tomioka":
    26.                 execute console command "/give %player% totem_of_undying 20"
    27.             if player has permission "kits.permission.mitsuri":
    28.                 execute console command "/give %player% totem_of_undying 30"
    29. on tab complete of "/kits":
    30.     player has permission "kits.permission.zenitsu"
    31.     add "Zenitsu" to tab completions
    32.     player has permission "kits.permission.tomioka"
    33.     add "Tomioka" to tab completions
    34.     player has permission "kits.permission.mitsuri"
    35.     add "Mitsuri" to tab completions
     
  2. Best Answer:
    Post #2 by lotzy, Sep 5, 2022
  3. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    179
    Likes Received:
    26
    You are using 'if' every time, but need 'else if'
    Code (Text):
    1. command /kits <text>:
    2.     executable by: players
    3.     permission: kits.permission.skript
    4.     permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    5.     cooldown: 20 seconds
    6.     cooldown message: "&e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim this kit again!"
    7.     trigger:
    8.         if arg-1 is not set:
    9.             send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
    10.         if arg-1 is set:
    11.             if player has permission "kits.permission.%arg-1%":
    12.                 execute console command "/ie give %arg-1%Sword %player% 1"
    13.                 execute console command "/ie give %arg-1%Axe %player% 1"
    14.                 execute console command "/ie give %arg-1%Pickaxe %player% 1"
    15.                 execute console command "/ie give %arg-1%Helmet %player% 1"
    16.                 execute console command "/ie give %arg-1%Chestplate %player% 1"
    17.                 execute console command "/ie give %arg-1%Leggings %player% 1"
    18.                 execute console command "/ie give %arg-1%Boots %player% 1"
    19.                 send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
    20.             else if player has permission "kits.permission.zenitsu":
    21.                 execute console command "/give %player% totem_of_undying 10"
    22.             else if player has permission "kits.permission.tomioka":
    23.                 execute console command "/give %player% totem_of_undying 20"
    24.             else if player has permission "kits.permission.mitsuri":
    25.                 execute console command "/give %player% totem_of_undying 30"
    26.             else:
    27.                 send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
    28. on tab complete of "/kits":
    29.     player has permission "kits.permission.zenitsu"
    30.     add "Zenitsu" to tab completions
    31.     player has permission "kits.permission.tomioka"
    32.     add "Tomioka" to tab completions
    33.     player has permission "kits.permission.mitsuri"
    34.     add "Mitsuri" to tab completions
     
  4. zKutari

    zKutari Member

    Joined:
    Sep 3, 2022
    Messages:
    4
    Likes Received:
    1
    TYSM!
    --- Double Post Merged, Sep 6, 2022, Original Post Date: Sep 5, 2022 ---
    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 (Text):
    1. command /kits <text>:
    2.     executable by: players
    3.     permission: kits.permission.skript
    4.     permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    5.     cooldown: 20 seconds
    6.     cooldown message: &e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim a kit again!
    7.     trigger:
    8.         if arg-1 is not set:
    9.             send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
    10.         if arg-1 is set:
    11.             if player has permission "kits.permission.%arg-1%":
    12.                 execute console command "/ie give %arg-1%Sword %player% 1"
    13.                 execute console command "/ie give %arg-1%Axe %player% 1"
    14.                 execute console command "/ie give %arg-1%Pickaxe %player% 1"
    15.                 execute console command "/ie give %arg-1%Helmet %player% 1"
    16.                 execute console command "/ie give %arg-1%Chestplate %player% 1"
    17.                 execute console command "/ie give %arg-1%Leggings %player% 1"
    18.                 execute console command "/ie give %arg-1%Boots %player% 1"
    19.                 send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
    20.             if player has permission "kits.permission.zenitsu":
    21.                 execute console command "/give %player% totem_of_undying 10"
    22.             else if player has permission "kits.permission.tomioka":
    23.                 execute console command "/give %player% totem_of_undying 20"
    24.             else if player has permission "kits.permission.mitsuri":
    25.                 execute console command "/give %player% totem_of_undying 30"
    26.             else:
    27.                 send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
    28. on tab complete of "/kits":
    29.     player has permission "kits.permission.zenitsu"
    30.     add "Zenitsu" to tab completions
    31.     player has permission "kits.permission.tomioka"
    32.     add "Tomioka" to tab completions
    33.     player has permission "kits.permission.mitsuri"
    34.     add "Mitsuri" to tab completions
     
    lotzy likes this.
  5. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    179
    Likes Received:
    26
    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 (Text):
    1. command /kits [<text>]:
    2.     executable by: players
    3.     permission: kits.permission.skript
    4.     permission message: "&e&l[Kit Bot]: &4&lYou do not have the permission to use /kits!"
    5.     cooldown: 20 seconds
    6.     cooldown message: &e&l[Kit Bot]: &4&lYou have to wait %remaining time% until you can claim a kit again!
    7.     trigger:
    8.         if arg-1 is not set:
    9.             send "&e&l[Kit Bot]: &4Usage: /kits <NameOfKit>" to player
    10.         else if player has permission "kits.permission.%arg-1%":
    11.             execute console command "/ie give %arg-1%Sword %player% 1"
    12.             execute console command "/ie give %arg-1%Axe %player% 1"
    13.             execute console command "/ie give %arg-1%Pickaxe %player% 1"
    14.             execute console command "/ie give %arg-1%Helmet %player% 1"
    15.             execute console command "/ie give %arg-1%Chestplate %player% 1"
    16.             execute console command "/ie give %arg-1%Leggings %player% 1"
    17.             execute console command "/ie give %arg-1%Boots %player% 1"
    18.            
    19.             if player has permission "kits.permission.mitsuri":
    20.                 execute console command "/give %player% totem_of_undying 30"
    21.             else if player has permission "kits.permission.tomioka":
    22.                 execute console command "/give %player% totem_of_undying 20"
    23.             else if player has permission "kits.permission.zenitsu":
    24.                 execute console command "/give %player% totem_of_undying 10"
    25.  
    26.             send "&e&l[Kit Bot]: &4&lYou succesfully received the %arg-1%-Kit!" to player
    27.         else:
    28.             send "&e&l[Kit Bot]: &4&lYou do not have the permission to claim this kit!" to player
     
Thread Status:
Not open for further replies.

Share This Page

Loading...