ID:159366
 
how do u make a team chat? like if your team = red, u get a verb called red team chat or something. then its like a normal chat but only people that is team = red can hear u.
and if ur team is blue then u get a verb blue team chat. and only blue team players can hear u.
Something like this would work.

var/list/Red
mob
verb/TeamSay(t as text)
if(src in Red)
for(var/mob/M in Red) M<<t
else //Blue team


I don't know if you could do Red<<"message", though I may test it later. Thats just a basic way of doing it
Well a really simple way is you just use the team list.


I'm guessing you already have lists for the teams, and if you don't make one and add the players to them when they join the team.

Then you can use the << command to the list. It will perform it on every player in the list.
var/list/Teams=list( "Red"=list() , "Blue"=list() )
mob
var/team
verb
TeamChat(s as text)
if(team)
Teams[team] << "[src]: [s]"
JoinTeam(t in Teams)
if(team)
Teams[team]-=src
team=t
Teams[t]+=src


Just a simple demostration of it. You should be able to get the idea from it, and make your own from that.




In response to Bakasensei
Yes You Can - the << operator supports either a mob, a client or a list of them as the left-hand/recipient argument.