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.

Help with skript (if player has permission, do xyz...)

Discussion in 'Skript' started by Aidan, Apr 7, 2021.

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

    Aidan Member

    Joined:
    Aug 7, 2020
    Messages:
    12
    Likes Received:
    0
    Hi!

    My skript I'm trying to create is to give out a golden shovel. If the player has the permission "GP.shovel", they can type the command "/shovel" (which every rank has.)

    If the player has the permission "GP.shovel.use", they can receive one golden shovel per five minutes. It will then send the player how much remaining time there is until the command can be used again.

    If the player has the permission "GP.shovel.admin", they can receive one golden shovel every time they type /shovel - No five minute delay.

    The problem is when I type /shovel with the permission GP.shovel.admin, it still sends me a message about how much time remaining I have, and gives me the shovel.
    As the default rank, which only has the permission GP.shovel.use, it will does the exact same thing as the people with the permission GP.shovel.admin. I was wondering if someone could help me
    I don't know if this makes any difference, but I use LuckPerms as my permissions plugin.

    Here is the code:
    Code (Text):
    1. command /shovel:
    2.     description: Gives you a shovel. Once per 5 minutes
    3.     permission: GP.shovel
    4.     executable by: players
    5.     trigger:
    6.         if player has the permission "GP.shovel.admin":
    7.             message "&6Recieving shovel!"
    8.             make console execute "give %player% golden_shovel 1"
    9.         if player has the permission "GP.shovel.use":
    10.             set {_waited} to difference between {shovel.%player%.lastused} and now
    11.             if {_waited} is less than 5 minutes:
    12.                 message "&6You have recently executed this command. Wait &c%difference between 5 minutes and {_waited}% &6until you can execute this command."
    13.                 stop
    14.        
    15.             player doesn't have space for a cake:
    16.                 message "You do not have enough space in your inventory to hold the shovel!"
    17.                 stop
    18.            
    19.             make console execute "give %player% golden_shovel 1"
    20.  
    21.             set {shovel.%player%.lastused} to now
    Thank you!
     
  2. Shadow501pl

    Shadow501pl Active Member

    Joined:
    Dec 19, 2020
    Messages:
    62
    Likes Received:
    2
    add "stop" after the admin one since the player has both permissions it will do both of these if's or make the other one elseif
     
  3. Aidan

    Aidan Member

    Joined:
    Aug 7, 2020
    Messages:
    12
    Likes Received:
    0
    I tried that before, and it still told the person with the permission GP.shovel.admin how much time was remaining.
    I even gave the staff no permissions for the rank GP.shovel.use
     
Thread Status:
Not open for further replies.

Share This Page

Loading...