Counter-Strike: Fix the round not restarting when players drop unexpectedly

or when the counter is otherwise out of sync on team joins.
This commit is contained in:
Marco Cawthorne 2021-02-14 01:31:21 +01:00
parent d5ae0c8dfd
commit 23edd47438
2 changed files with 10 additions and 0 deletions

View file

@ -47,6 +47,7 @@ class CSMultiplayerRules:CSGameRules
virtual void(void) InitPostEnts;
virtual void(void) FrameStart;
virtual void(base_player) PlayerDisconnect;
virtual void(base_player) PlayerSpawn;
virtual void(base_player) PlayerPreFrame;
virtual void(base_player) PlayerDeath;

View file

@ -24,6 +24,13 @@ CSMultiplayerRules::MaxItemPerSlot(int slot)
return 1;
}
void
CSMultiplayerRules::PlayerDisconnect(base_player pl)
{
if (health > 0)
PlayerDeath(pl);
}
void
CSMultiplayerRules::PlayerDeath(base_player pl)
{
@ -990,6 +997,8 @@ void CSEv_JoinTeam_f(float flChar)
pl.deaths = 0;
forceinfokey(pl, "*deaths", ftos(pl.deaths));
rules.CountPlayers();
/* if no players are present in the chosen team, force restart round */
if ((pl.team == TEAM_T) && (g_cs_alive_t == 0)) {
rules.RoundOver(FALSE, 0, FALSE);