- command /team [<text>] [<text>]:
- trigger:
- if arg-1 is "create":
- if {team.%player%} is not set:
- if arg-2 is set:
- if {team list::*} contains arg-2:
- send "&cName is taken"
- else:
- set {team create date.%arg-2%} to now
- broadcast "%arg-2% team has been created"
- set {team.%player%} to arg-2
- set {team status.%arg-2%} to "Closed"
- send "&aCreated a team named &3%arg-2%"
- set {team owner.%arg-2%} to "%player%" parsed as player
- add player to {team members players.%arg-2%::*}
- add 1 to {team members.%arg-2%}
- add arg-2 to {team list::*}
- stop
- else:
- send "&cLeave your current team to create one"
- stop
- else if arg-1 is "list":
- set {_teams list::*} to {team list::*}
- set {_size} to size of {team list::*}
- loop {_size} times:
- set {_team} to a random element out of {_teams list::*}
- remove {_team} from {_teams list::*}
- send "%{_team}%"
- stop
- else if arg-1 is "leave":
- if {team.%player%} is set:
- if {team owner.%{team.%player%}%} is player:
- send "&cYou cant leave your own team"
- send "&c/team delete to delete it"
- stop
- else:
- loop {team members players.%{team.%player%}%::*}:
- if "%loop-value%" != "%player%":
- send "%player% left your team" to loop-value
- remove 1 from {team members.%{team.%player%}%}
- remove player from {team members.%{team.%player%}%}
- send "&aLeft %{team.%player%}%"
- delete {team.%player%}
- stop
- else:
- send "&cYou are not in a team"
- stop
- else if arg-1 is "chat":
- if {team.%player%} is set:
- if {team chat.%player%} is true:
- delete {team chat.%player%}
- send " "
- send "&a Disabled team chat"
- send " "
- stop
- else:
- set {team chat.%player%} to true
- send " "
- send "&a Enabled team chat"
- send " "
- stop
- else if arg-1 is "join":
- if arg-2 is set:
- if {team.%player%} is not set:
- if {team status.%arg-2%} is "Closed":
- send "&cteam is Closed"
- else:
- set {team.%player%} to arg-2
- add player to {team members players.%arg-2%::*}
- add 1 to {team members.%arg-2%}
- send "&aJoined %arg-2%"
- loop {team members players.%{team.%player%}%::*}:
- if "%loop-value%" != "%player%":
- send "%player% joined your team" to loop-value
- else:
- send "&cLeave you current team to join a new one"
- else if arg-1 is "delete":
- if {team.%player%} is set:
- if {team owner.%{team.%player%}%} is player:
- if {wanna delete.%{team.%player%}%} is set:
- broadcast "%{team.%player%}% has been disbanded"
- delete {wanna delete.%{team.%player%}%}
- delete {team owner.%{team.%player%}%}
- delete {wanna delete cooldown.%{team.%player%}%}
- remove player from {team members players.%{team.%player%}%::*}
- loop {team members players.%{team.%player%}%::*}:
- delete {team.%loop-value%}
- send "Your team has been disbanded"
- delete {team members players.%{team.%player%}%::*}
- delete {team members.%{team.%player%}%}
- remove {team.%player%} from {team list::*}
- delete {team.%player%}
- else:
- set {wanna delete.%{team.%player%}%} to true
- send "&c/team delete to confirm"
- set {wanna delete cooldown.%{team.%player%}%} to 10
- send "&cYou have 10 seconds"
- else:
- send "&cYou must be the team owner to delete the team"
- else if arg-1 is "kick":
- if {team members players.%{team.%player%}%::*} contains arg-2:
- if {team.%player%} is set:
- if {team owner.%{team.%player%}%} is player:
- set {_p} to arg-2 parsed as player
- send "&aKicked &e%arg-2% from &3%{team.%player%}%"
- remove arg-2 from {team members players.%{team.%player%}%::*}
- remove 1 from {team members.%{team.%player%}%}
- send "You have been kicked from %{team.%arg-2%}%" to {_p}
- delete {team.%arg-2%}
- else:
- send "&cYou must be the team owner to kick players"
- else:
- send "&c%arg-2% &cis not in your team"
- else if arg-1 is "invite":
- if arg-2 is set:
- if {team owner.%{team.%player%}%} is player:
- loop all players:
- add loop-player to {_players::*}
- if {_players::*} contains arg-2:
- if {team.%arg-2%} is not set:
- set {_p} to arg-2 parsed as player
- set {invited to.%arg-2%} to {team.%player%}
- send "&aInvited %arg-2%"
- send "You have been invite to join %{team.%player%}%" to {_p}
- send "/team accept" to {_p}
- send "/team decline" to {_p}
- else:
- send "&c%arg-2% &cis in a team"
- else:
- send "&c%arg-2% &cis not online"
- else:
- send "&cYou must be the team owner to invite people"
- else if arg-1 is "close":
- if {team owner.%{team.%player%}%} is player:
- set {team status.%{team.%player%}%} to "Closed"
- broadcast "%{team.%player%}% team has been closed"
- send "Closed your team"
- else:
- send "&cYou must be the team owner to change the team status"
- else if arg-1 is "open":
- if {team owner.%{team.%player%}%} is player:
- set {team status.%{team.%player%}%} to "Open"
- broadcast "%{team.%player%}% team has been opened"
- send "Opened your team"
- else:
- send "&cYou must be the team owner to change the team status"
- else if arg-1 is "accept":
- if {invited to.%player%} is set:
- set {team.%player%} to {invited to.%player%}
- add player to {team members players.%{invited to.%player%}%::*}
- add 1 to {team members.%{invited to.%player%}%}
- loop {team members players.%{team.%player%}%::*}:
- if "%loop-value%" != "%player%":
- send "%player% joined your team" to loop-value
- send "You joined %{team.%player%}%"
- delete {invited to.%player%}
- else:
- send "&cYou have no invites"
- else if arg-1 is "decline":
- if {invited to.%player%} is set:
- send "&cDeclined the invite from %{invited to.%player%}%"
- send "&c%player% &cdeclined your invite" to {team owner.%{invited to.%player%}%}
- delete {invited to.%player%}
- else:
- send "&cYou have no invites"
- else if arg-1 is "info":
- if arg-2 is set:
- if {team list::*} contains arg-2:
- send "&eName: &6%arg-2%"
- send "&eMembers: &6%{team members.%arg-2%}%"
- send "&eOwner: &6%{team owner.%arg-2%}%"
- send "&eStatus: &6%{team status.%arg-2%}%"
- send "&eMade On: &6%{team create date.%arg-2%}%"
- else:
- send "&c%arg-2% &cis not a team"
- else if arg-1 is "trust":
- if {team members players.%{team.%player%}%::*} contains arg-2:
- if {team.%player%} is set:
- if {team owner.%{team.%player%}%} is player:
- set {_p} to arg-2 parsed as player
- set {team trusted.%arg-2%} to true
- send "%arg-2% is now trused and can't be damaged"
- send "you are now trusted in your team" to {_p}
- else:
- send "&cOnly the team owner can trust people"
- else:
- send "&c%arg-2% &cis not in your team"
- else if arg-1 is "untrust":
- if {team members players.%{team.%player%}%::*} contains arg-2:
- if {team.%player%} is set:
- if {team owner.%{team.%player%}%} is player:
- set {_p} to arg-2 parsed as player
- delete {team trusted.%arg-2%}
- send "%arg-2% is no longer trused"
- send "you are no longer trusted in your team" to {_p}
- else:
- send "&cOnly the team owner can trust people"
- else:
- send "&c%arg-2% &cis not in your team"
- else if arg-1 is "help":
- send "/team delete - deletes the team"
- send "/team chat - this command you can toggle it off and on"
- send "/team create (team name ) - creates the team name"
- send "/team invite (player) - invites the player to the team"
- send "/team kick (player) kicks the player from the team"
- send "/team join (team) - joins the team"
- send "/team list - List of teams"
- send "/team info (team) - shows the invitation of the team"
- send "/team open - Anyone can join your team without invite"
- send "/team close - Closes the team"
- else if arg-1 is "clear":
- if player has permission "team.clear":
- if {team list::*} contains arg-2:
- delete {team owner.%arg-2%}
- loop {team members players.%arg-2%::*}:
- send "Your team was disbanded by %player%" to loop-value
- delete {team.%loop-value%}
- delete {team members players.%arg-2%::*}
- delete {team members.%arg-2%}
- remove arg-2 from {team list::*}
- send "You cleared team %arg-2%"
- else:
- send "&cThis is not a real team"
- else:
- make player execute command "/team help"
- else:
- make player execute command "/team help"
- every 2 seconds:
- loop all players:
- if {wanna delete.%{team.%loop-player%}%} is set:
- remove 2 from {wanna delete cooldown.%{team.%loop-player%}%}
- if {wanna delete cooldown.%{team.%loop-player%}%} is 0:
- send "&cTime is over" to loop-player
- delete {wanna delete cooldown.%{team.%loop-player%}%}
- delete {wanna delete.%{team.%loop-player%}%}
- on quit:
- delete {invited to.%player%}
- on chat:
- if {team chat.%player%} is set:
- cancel event
- loop {team members players.%{team.%player%}%::*}:
- send "&6&l[TEAM CHAT] &e%player%: &e%message%" to loop-value
- else:
- stop
- on damage:
- attacker is a player
- victim is a player:
- if {team.%attacker%} is equal to {team.%victim%}:
- if {team trusted.%victim%} is true:
- cancel event
- send "&c%victim% &cis trusted in your guild" to attacker