2 types of arguments at same time?

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

Kyllian

New Member
Oct 7, 2017
6
0
0
28
Belgium
kyle.development.com
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_language.skript:
command /rekening [<text>] [<text> or <player>] [<number>]:
    trigger:
        if player is op:
            if arg-1 = "maak":
                if arg-2 is not set:
                    message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
                if arg-2 is set:
                    set {%player%.rekening} to arg-2
                    message "&bRekening &7&l>> &fJe rekening heet nu %{%player%.rekening}%!" to player
            if arg-1 = "set":
                if arg-2 is not set:
                    message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
                if arg-3 is not set:
                    message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
                else:
                    set {%arg-2%.geld} to argument 3
                    message "&bRekening &7&l>> &fJe hebt het geld van %arg-2% gezet naar %arg-3%." to player
                    message "&bRekening &7&l>> &fJe geld werd gezet naar %arg-3%." to arg-2
 
Just make it [<text>] instead of [<text> or <player>]
Then check if the text is parsed as a player
 
Still not working...

code_language.skript:
command /rekening [<text>] [<text>] [<number>]:
    trigger:
        if player is op:
            if arg-1 = "maak":
                if arg-2 is not set:
                    message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
                if arg-2 is set:
                    set {%player%.rekening} to arg-2
                    message "&bRekening &7&l>> &fJe rekening heet nu %{%player%.rekening}%!" to player
            if arg-1 = "set":
                if arg-2 is not set:
                    message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
                if arg-3 is not set:
                    message "&b&lInfo &7&l>> &fZo gebruik je het command: &7/rekening [maak, set] [naam] [nummer]"
                else:
                    if arg-2 is parsed as a player:
                        set {%arg-2%.geld} to argument 3
                        message "&bRekening &7&l>> &fJe hebt het geld van %arg-2% gezet naar %arg-3%." to player
                        message "&bRekening &7&l>> &fJe geld werd gezet naar %arg-3%." to arg-2
 
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).
 
Status
Not open for further replies.