Solved Multiple Commands with the same route command but with different arguments

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

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
Hi there! So, I am making a team skript, almost like factions, except it is for PvP, and I need about 7 commands for this such as /team create <name>, /team join <name>, etc. So, I understand how to skript it, but the one thing that troubles me is making those commands with the same route command, in this case, it is "team". This is the error; pretty basic: [13:52:58 ERROR]: A command with the name /team is already defined in scripts.sk (scripts.sk, line 19: command /team <text> <text>:')

Thanks a lot guys! You guys are amazing! Have a great weekend! :emoji_slight_smile: - LoneElf
 
/team <text> <text>
If arg 1 is "create":
#do stuff (use %arg 2% for the name of the team)
if arg 1 is "join":
#do stuff(make player join team %arg 2%).

Example, one of my codes with multiples commands inside one command:

code_language.skript:
command /cheque <text>:
  usage: Digite /cheque 1 ou /cheque 2.
  description: Emite cheques para elevar o valor de venda de itens pelo shopkeepers.
  trigger:
    if arg 1 = "1":
      loop all items in player's inventory:
        loop-item is paper
        loop-item's name isn't set
        set the name of the loop-item to "§5&lCheque"
        set line 1 of loop-item's lore to "Emitido por §a%player%"
      message "&6[&cCHEQUES&6] &rVocê transformou em cheques §btipo 1&r os papeis em branco no seu inventário!"
      clear {emitir.%player%.waiting}
      stop
    if arg 1 = "2":
      loop all items in player's inventory:
        loop-item is paper
        loop-item's name isn't set
        set loop-item to glowing loop-item
        set the name of the loop-item to "§5&lCheque §2&lAes§6&lGold"
        set line 1 of loop-item's lore to "Emitido por §a%player%"
      message "&6[&cCHEQUES&6] &rVocê transformou em cheques §etipo 2&r os papeis em branco no seu inventário!"
      clear {emitir.%player%.waiting}
      stop
    else:
      message "&6[&cCHEQUES&6] &rUtilize /cheque 1 ou /cheque 2"

tl;dr: Use arg 1 and arg 2 checks to do your stuff with "if" statements.
 
OH! Thanks so much man! :emoji_slight_smile:
[doublepost=1493590099,1493588538][/doublepost]Now, how can I make an argument be a text or a player because some of my commands require a player, and some require a string. Thanks :emoji_slight_smile:
 
Nope. It doesn't work :emoji_stuck_out_tongue: Here is my code for that bit:
code_language.skript:
command /team [<text>] [<text>]|[<player>]:
    trigger:
        if arg 1 is "invite":
            if arg 2 is a player:
                message "&cTest Message."

Here is the error: [15:14:38 ERROR]: Can't compare a text with an entity type (scripts.sk, line 32: if arg 2 is a player:')
 
I did that, but now, it doesn't send the message. I type /team invite LoneElf , and no message is sent. Also, the command that I didn't show you (The /team create <text>) command doesn't work, so I think it is because of the player & the text that skript doesn't like.
 
Nothing. Same thing. All my code:
code_language.skript:
command /team [<text>] [<text>|<player>]:
    trigger:
        if arg 1 is not set:
            if arg 2 is not set:
                message ""
                message "&f&l&m-------------------"
                message "        &8»  &7Teams  &8«"
                message ""
                message "  &b/team create <name>"
                message "  &b/team invite <player>"
                message "  &b/team join <team>"
                message "  &b/team admin <player>"
                message "  &b/team owner <player>"
                message "  &b/team demote <player>"
                message "  &b/team kick <player>"
                message "  &b/team disband"
                message "&f&l&m-------------------"
                message ""
        if arg 1 is "create":
            if arg 2 is set:
                if {team.in.%uuid of player%} is true:
                    message "&c&l!!  &7You are already in a team! Type /team leave!"
                else:
                    message "&8[&9Teams&8] &bYou have created a team named %arg-2%!"
                    set {team.in.%uuid of player%} to true
                    add arg 2 to {teams}
                    set {team.leader.%uuid of player%} to true
        if arg 1 is "invite":
            if arg 2 is player:
                broadcast "hi"
[doublepost=1493598235,1493591122][/doublepost]Anybody know how to fix my problem? Thanks :emoji_slight_smile:
[doublepost=1493602132][/doublepost]@aescraft Do you know a solution? Anybody! Please help me! Thanks :emoji_slight_smile:
 
Do something like this...
code_language.skript:
command /team [<text>] [<text>]:
    trigger:
        if arg 1 is "invite":
            if arg 2 exists:
                set {_arg2} to argument 2 parsed as player
                broadcast "%&e{_arg2}% &fhas joined your team!" #<-- This is to see if it works
 
  • Like
Reactions: aescraft
Status
Not open for further replies.