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 How to make this more efficient?

Discussion in 'Skript' started by GamingDay, Jul 19, 2020.

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

    GamingDay Member

    Joined:
    May 28, 2020
    Messages:
    4
    Likes Received:
    0
    I have a script that blocks users from using certain commands (don't question my ways):
    Code (Text):
    1. on command "/command1":
    2.     if player doesn't have permission "{@permission}":
    3.         message "{@nopermissions}"
    4.         cancel event
    5.    
    6. on command "/command2":
    7.     if player doesn't have permission "{@permission}":
    8.         message "{@nopermissions}"
    9.         cancel event
    10.        
    11. on command "/command3":
    12.     if player doesn't have permission "{@permission}":
    13.         message "{@nopermissions}"
    14.         cancel event
    15.        
    16. on command "/command4":
    17.     if player doesn't have permission "{@permission}":
    18.         message "{@nopermissions}"
    19.         cancel event
    etc etc
    Let it be known that I know nothing about Skript, is it possible to make this more efficient?
    Something like:
    Code (Text):
    1. on command "/command1" or "/command2" or "/command3" or "/command4":
    2.     if player doesn't have permission "{@permission}":
    3.         message "{@nopermissions}"
    4.         cancel event
    but that will actually work.
     
  2. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    This should work right.
    I don't know why but I can't get the on command "hello" or "hello2": to work..

    Code (Text):
    1. on command:
    2.   if command is "command1", "command2", "command3" or "command4":
    3.     if player does not have permission "{@permission}":
    4.       message "{@nopermissions}"
    5.       cancel event
     
  3. GamingDay

    GamingDay Member

    Joined:
    May 28, 2020
    Messages:
    4
    Likes Received:
    0
    Let's say I have about a hundred of these:
    Code (Text):
    1. on command "/command":
    2.     if player doesn't have permission "{@permission}":
    3.         message "{@nopermissions}"
    4.         cancel event
    Will this really make it faster/more efficient?
    Code (Text):
    1. on command:
    2.   if command is "command1", "command2", "command3" or "command4":
    3.     if player does not have permission "{@permission}":
    4.       message "{@nopermissions}"
    5.       cancel event
     
  4. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    Mine will make it more efficient.
    You shouldn't have that much code.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...