ID:141760
 
Code:
            if(team) //is it a team battle?
if(!m.team in teams) //would this be an appropriate way to check if the team isn't already in teams?
teams+=m.team //add m's team to the list of teams.
world<<"teams now contains:"
for(var/a in teams)
world<<a


Problem description:

This doesn't seem to work. How could I do this differently?
In response to GhostAnime
Ah okay. Still I'm not exactly familiar with lists. I just want it so when a new team enters, it adds it to the team list, and when an entire team is wiped out, it checks to see if there's only one team left and if there is they win. etc.

        Add_Player(mob/m) //adds a player to this handle.
if(!m||!ismob(m))
world<<"\red Invalid player to add."
return
world<<"[m] has joined the battle."
players+=m
m.playing=1
if(team) //is it a team battle?
world<<"team battle in progress."
if(!(m.team in teams))
teams+=m.team //add m's team to the list of teams.
world<<"teams now contains:"
for(var/a in teams)
world<<a
world<<m.team
Remove_Player(mob/m) //removes a player from handle.
if(!m||!ismob(m))
world<<"\red Invalid player to remove."
return
players-=m
if(team)
var/q
for(var/a in teams)
for(var/mob/y in a)
q=1
if(!q) //no players left
teams-=m.team
world<<"team [m.team.name] has been completely wiped out!"
if(teams.len<2)
var/i
for(var/mob/a in players)
if(!a.team) //rogue npc's/players
i=1
if(!i) //nothing left but the single team.
world<<"The battle is over, as only one team remains."
for(var/mob/a in players)
a.playing=0
a.turn=0
for(var/mob/f in players)
world<<"The winning team was [f.team.name]"
del src