Add 2 players to the same team

Discussion in 'Skript' started by Unsalt, Jun 1, 2018.

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

    After a player runs /team join <player>, how do I make it so that the player and arg-2 gets added to the same team + how do I limit the team size to only 2 players?
     
  2. Not sure about the first one, but for a limit you could make it with an if statement. For example;
    Code (Text):
    command /join:
        Trigger:
                If {team} is 2
                        send "Team us full"
                        Cancel the event
     
  3. Sorry for my messy code, am on my phone.
     
  4. Two

    Two

    Code (Text):
    command /team <player>:
      trigger:
        if {team::%uuid of player%} is set:
          message "You are in a team already"
          stop
        if {team::%arg-1's uuid%} is set:
          message "%arg-1% is in a team already"
          stop
        set {team::%uuid of player%} to arg-1's uuid
        set {team::%arg-1's uuid%} to player's uuid
        send "You are now in a team with %arg-1%" to player
        send "You are now in a team with %player%" to arg-1
    This is a simple version of what you described.
     
    • Creative Creative x 1
  5. I know this is a lot for an example, but I decided to advance this more for you, use what you'd like. :p

    Code (Text):
    Variables:
        {team.%player%} = NONE
        {team-red} = 0
        {team-blue} = 0

    command /team [<text>] [<player>]:
      trigger:
        if arg 1 is "join":
          if arg 2 is set:
            if {team.%arg player%} is "Red":
              if {team-red} is 2:
                send "&cTeam is full."
              else:
                add 1 to {team-red}
                set {team.%player%} to "Red"
                send "&aYou have joined team red."
            if {team.%arg player%} is "Blue":
              if {team-blue} is 2:
                send "&cTeam is full."
              else:
                add 1 to {team-blue}
                set {team.%player%} to "Blue"
                send "&aYou have joined team blue."
            if {team.%arg player%} is "NONE":
              send "&c%arg player% is not on a team."
             
    command /team-red:
      trigger:
        if {team.%player%} is "Red":
          send "&cYou are already on team red."
        else:
          add 1 to {team-red}
          set {team.%player%} to "Red"
          send "&aYou have joined team red."

    command /team-blue:
      trigger:
        if {team.%player%} is "Blue":
          send "&cYou are already on team blue."
        else:
          add 1 to {team-blue}
          set {team.%player%} to "Blue"
          send "&aYou have joined team blue."
       
    command /team-leave:
      trigger:
        if {team.%player%} is "NONE":
          send "&cYou are not on a team."
        if {team.%player%} is "Red":
          remove 1 from {team-red}
          wait 1 tick
          set {team.%player%} to "NONE"
          send "&aYou have left your current team. (Red)"
        if {team.%player%} is "Blue":
          remove 1 from {team-blue}
          wait 1 tick
          set {team.%player%} to "NONE"
          send "&aYou have left your current team. (Blue)"
             
    command /teamsee [<player>]:
      trigger:
        send "&a%arg player%'s Team: %{team.%arg player%}%"
     
    • Creative Creative x 1
  6. -2-

    -2-

    Seems like this will work!
     
Thread Status:
Not open for further replies.