}
}
+void KillPlayerForTeamChange(entity player)
+{
+ if (IS_DEAD(player))
+ {
+ return;
+ }
+ if (MUTATOR_CALLHOOK(Player_ChangeTeamKill, player) == true)
+ {
+ return;
+ }
+ Damage(player, player, player, 100000, DEATH_TEAMCHANGE.m_id, player.origin,
+ '0 0 0');
+}
+
bool SetPlayerTeamSimple(entity player, int team_num)
{
if (player.team == team_num)
{
AutoBalanceBots(old_team, Team_TeamToNumber(best_team));
}
- if (!IS_DEAD(this) && (MUTATOR_CALLHOOK(Player_ChangeTeamKill, this) ==
- false))
- {
- Damage(this, this, this, 100000, DEATH_TEAMCHANGE.m_id, this.origin, '0 0 0');
- }
+ KillPlayerForTeamChange(this);
return best_team;
}
{
return;
}
- // kill player when changing teams
- if (IS_DEAD(this) || (MUTATOR_CALLHOOK(Player_ChangeTeamKill, this) == true))
- {
- return;
- }
- Damage(this, this, this, 100000, DEATH_TEAMCHANGE.m_id, this.origin, '0 0 0');
+ KillPlayerForTeamChange(this);
}
void AutoBalanceBots(int source_team, int destination_team)
}
SetPlayerTeamSimple(lowest_bot_destination_team,
Team_NumberToTeam(source_team));
- if (IS_DEAD(lowest_bot_destination_team) || (MUTATOR_CALLHOOK(
- Player_ChangeTeamKill, lowest_bot_destination_team) == true))
- {
- return;
- }
- Damage(lowest_bot_destination_team, lowest_bot_destination_team,
- lowest_bot_destination_team, 100000, DEATH_TEAMCHANGE.m_id,
- lowest_bot_destination_team.origin, '0 0 0');
+ KillPlayerForTeamChange(lowest_bot_destination_team);
}
void SetPlayerColors(entity player, float _color);
+/// \brief Kills player as a result of team change.
+/// \param[in,out] player Player to kill.
+/// \return No return.
+void KillPlayerForTeamChange(entity player);
+
/// \brief Sets the team of the player.
/// \param[in,out] player Player to adjust.
/// \param[in] team_num Team number to set. See TEAM_NUM constants.