LogTeamchange(pl.playerid, pl.team, 2); // log auto join
- if(pl.deadflag == DEAD_NO)
+ if(!IS_DEAD(pl))
Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE.m_id, pl.origin, '0 0 0');
}
float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount;
// in normal deathmatch we can just apply the color and we're done
- if(!teamplay) {
+ if(!teamplay)
SetPlayerColors(self, _color);
+
+ if(!IS_CLIENT(self))
+ {
+ // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_CONNECTING, self.netname);
return;
}
+ if(!teamplay)
+ return;
+
scolor = self.clientcolors & 0x0F;
dcolor = _color & 0x0F;
TeamchangeFrags(self);
}
- // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
- if(!IS_CLIENT(self))
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_CONNECTING, self.netname);
-
MUTATOR_CALLHOOK(Player_ChangeTeam, self, steam, dteam);
SetPlayerTeam(self, dteam, steam, !IS_CLIENT(self));
if(IS_PLAYER(self) && steam != dteam)
{
// kill player when changing teams
- if(self.deadflag == DEAD_NO)
+ if(!IS_DEAD(self))
Damage(self, self, self, 100000, DEATH_TEAMCHANGE.m_id, self.origin, '0 0 0');
}
}
{
float smallestteam, smallestteam_count, steam;
float lowest_bot_score, lowest_player_score;
- entity head, lowest_bot, lowest_player, selected;
+ entity lowest_bot, lowest_player, selected;
smallestteam = 0;
smallestteam_count = 999999999;
lowest_player_score = 999999999;
// find the lowest-scoring player & bot of that team
- FOR_EACH_PLAYER(head)
- {
- if(head.team == steam)
+ FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
+ if(it.isbot)
{
- if(head.isbot)
+ if(it.totalfrags < lowest_bot_score)
{
- if(head.totalfrags < lowest_bot_score)
- {
- lowest_bot = head;
- lowest_bot_score = head.totalfrags;
- }
+ lowest_bot = it;
+ lowest_bot_score = it.totalfrags;
}
- else
+ }
+ else
+ {
+ if(it.totalfrags < lowest_player_score)
{
- if(head.totalfrags < lowest_player_score)
- {
- lowest_player = head;
- lowest_player_score = head.totalfrags;
- }
+ lowest_player = it;
+ lowest_player_score = it.totalfrags;
}
}
- }
+ ));
// prefers to move a bot...
if(lowest_bot != world)
TeamchangeFrags(selected);
SetPlayerTeam(selected, smallestteam, source_team, false);
- if(selected.deadflag == DEAD_NO)
+ if(!IS_DEAD(selected))
Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE.m_id, selected.origin, '0 0 0');
Send_Notification(NOTIF_ONE, selected, MSG_CENTER, CENTER_DEATH_SELF_AUTOTEAMCHANGE, selected.team);
}