Argument with multiple routes

  • 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.
I usually do something like this:

Code:
command /blah [<text>]:
  trigger:
    if whatever:
      set {_c} to arg-1 parsed as an item
    else:
      set {_c} to arg-1
    continue..
 
Yeah, but I'm trying to do something like this:

Code:
        if arg 1 is set:
            if arg 1 is "command":
                if arg 2 is between 1 and 1000:
                    send "&cYou received &f%arg 1%"
                    set {_num} to 0
                    stop
 
It's not working for me :/ can you help me

Code:
command /item [<text>] [<integer>]:
    permission: admin
    permission message: &cLol no
    trigger:
        if arg 1 is not set:
            send "&4Error: &c/item <item> <amount>"
            stop
        if arg 1 is set:
            if arg 1 is "dirt2":
                if arg 2 is between 1 and 1000:
                    send "&cYou received &f%arg 1%"
                    give player dirt parsed as an item
                    stop
        if arg 1 is set:
            if arg 2 is between 1 and 1000:
                send "&cYou received &f%arg 1%"
                give player arg-1 parsed as an item
                stop
            if arg 2 is not between 1 and 1000:
                send "&4Error: &cYou can only give yourself 1 - 1,000 items!"
                stop
 
Fixed your code:

Code:
command /item [<text>] [<integer>]:
    permission: admin
    permission message: &cLol no
    trigger:
        if arg-1 is not set:
            send "&4Error: &c/item <item> <amount>"
        else:
            if arg-1 is "dirt2":
                if arg-2 is between 1 and 1000:
                    send "&cYou received &f%arg-1%"
                    loop arg-2 times:
                        give dirt to player
            if arg-2 is between 1 and 1000:
                send "&cYou received &f%arg 1%"
                loop arg-2 times:
                    give (arg-1 parsed as an item) to player
            if arg-2 is not between 1 and 1000:
                send "&4Error: &cYou can only give yourself 1 - 1,000 items!"
 
It works, but if you type in "askjdgasjhdhasjd" or anything, it tells you that you got "askjdgasjhdhasjd".
 
Then check if its a valid item.
Code:
if (arg-1 parsed as an item) is not an item:
  send "Blah"
 
Status
Not open for further replies.