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.

2 types of arguments at same time?

Discussion in 'Skript' started by Kyllian, Apr 18, 2018.

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

    Kyllian New Member

    Joined:
    Oct 7, 2017
    Messages:
    6
    Likes Received:
    0
    Hello i have a little problem, im making a custom command but there are different possiblities in my command that i need 2 types of arguments at the same time... Is this possible? Here is my skript;
    Code (Skript):
    1. command /rekening [<text>] [<text> or <player>] [<number>]:
    2.     trigger:
    3.         if player is op:
    4.             if arg-1 = "maak":
    5.                 if arg-2 is not set:
    6.                     message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
    7.                 if arg-2 is set:
    8.                     set {%player%.rekening} to arg-2
    9.                     message "&bRekening &7&l>> &fJe rekening heet nu %{%player%.rekening}%!" to player
    10.             if arg-1 = "set":
    11.                 if arg-2 is not set:
    12.                     message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
    13.                 if arg-3 is not set:
    14.                     message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
    15.                 else:
    16.                     set {%arg-2%.geld} to argument 3
    17.                     message "&bRekening &7&l>> &fJe hebt het geld van %arg-2% gezet naar %arg-3%." to player
    18.                     message "&bRekening &7&l>> &fJe geld werd gezet naar %arg-3%." to arg-2
     
  2. SpinKnight

    Supporter + Supporter

    Joined:
    May 24, 2017
    Messages:
    30
    Likes Received:
    0
    Just make it [<text>] instead of [<text> or <player>]
    Then check if the text is parsed as a player
     
    • Agree Agree x 1
  3. Kyllian

    Kyllian New Member

    Joined:
    Oct 7, 2017
    Messages:
    6
    Likes Received:
    0
    Still not working...

    Code (Skript):
    1. command /rekening [<text>] [<text>] [<number>]:
    2.     trigger:
    3.         if player is op:
    4.             if arg-1 = "maak":
    5.                 if arg-2 is not set:
    6.                     message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
    7.                 if arg-2 is set:
    8.                     set {%player%.rekening} to arg-2
    9.                     message "&bRekening &7&l>> &fJe rekening heet nu %{%player%.rekening}%!" to player
    10.             if arg-1 = "set":
    11.                 if arg-2 is not set:
    12.                     message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
    13.                 if arg-3 is not set:
    14.                     message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
    15.                 else:
    16.                     if arg-2 is parsed as a player:
    17.                         set {%arg-2%.geld} to argument 3
    18.                         message "&bRekening &7&l>> &fJe hebt het geld van %arg-2% gezet naar %arg-3%." to player
    19.                         message "&bRekening &7&l>> &fJe geld werd gezet naar %arg-3%." to arg-2
     
  4. DieHollander_

    DieHollander_ Active Member

    Joined:
    Mar 25, 2018
    Messages:
    188
    Likes Received:
    12
    • Agree Agree x 1
  5. Mr_Simba

    Mr_Simba King of the Pridelands
    Moderator Supporter

    Joined:
    Dec 9, 2016
    Messages:
    257
    Likes Received:
    56
    Medals:
    Ideally instead of 'if arg-2 is parsed as a player' you'd do 'if arg-2 parsed as a player is set'.

    Also look up what an 'else if' statement is. Will make your code smarter and probably marginally faster (you're checking unnecessary if statements in three places here).
     
Thread Status:
Not open for further replies.

Share This Page

Loading...