diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp index e763901b9..2deba9def 100644 --- a/src/game/server/teams.cpp +++ b/src/game/server/teams.cpp @@ -442,17 +442,20 @@ void CGameTeams::ChangeTeamState(int Team, int State) m_TeamState[Team] = State; } -void CGameTeams::KillTeam(int Team, int NewStrongID) +void CGameTeams::KillTeam(int Team, int NewStrongID, int ExceptID) { for(int i = 0; i < MAX_CLIENTS; i++) { if(m_Core.Team(i) == Team && GameServer()->m_apPlayers[i]) { GameServer()->m_apPlayers[i]->m_VotedForPractice = false; - GameServer()->m_apPlayers[i]->KillCharacter(WEAPON_SELF); - if(NewStrongID != -1 && i != NewStrongID) + if(i != ExceptID) { - GameServer()->m_apPlayers[i]->Respawn(true); // spawn the rest of team with weak hook on the killer + GameServer()->m_apPlayers[i]->KillCharacter(WEAPON_SELF); + if(NewStrongID != -1 && i != NewStrongID) + { + GameServer()->m_apPlayers[i]->Respawn(true); // spawn the rest of team with weak hook on the killer + } } } } @@ -1006,7 +1009,7 @@ void CGameTeams::OnCharacterDeath(int ClientID, int Weapon) m_Practice[Team] = false; - KillTeam(Team, Weapon == WEAPON_SELF ? ClientID : -1); + KillTeam(Team, Weapon == WEAPON_SELF ? ClientID : -1, ClientID); if(Count(Team) > 1) { GameServer()->SendChatTeam(Team, aBuf); diff --git a/src/game/server/teams.h b/src/game/server/teams.h index c380a9ea0..3f8999981 100644 --- a/src/game/server/teams.h +++ b/src/game/server/teams.h @@ -35,10 +35,13 @@ class CGameTeams class CGameContext *m_pGameContext; - // Kill the whole team, making the player `NewStrongID` have strong - // hook on everyone else. `NewStrongID` can be -1 to get the normal - // spawning order. - void KillTeam(int Team, int NewStrongID); + /** + * Kill the whole team. + * @param Team The team id to kill + * @param NewStrongID The player with that id will get strong hook on everyone else, -1 will set the normal spawning order + * @param ExceptID The player that should not get killed + */ + void KillTeam(int Team, int NewStrongID, int ExceptID = -1); bool TeamFinished(int Team); void OnTeamFinish(CPlayer **Players, unsigned int Size, float Time, const char *pTimestamp); void OnFinish(CPlayer *Player, float Time, const char *pTimestamp);