Skip to content

Commit 5850e3a

Browse files
committed
Correctly end round if last team player DCs
- Fixes #271
1 parent 3957c9f commit 5850e3a

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/cs2fixes.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,13 @@ void CS2Fixes::Hook_ClientPutInServer(CPlayerSlot slot, char const* pszName, int
915915
void CS2Fixes::Hook_ClientDisconnect(CPlayerSlot slot, ENetworkDisconnectionReason reason, const char* pszName, uint64 xuid, const char* pszNetworkID)
916916
{
917917
Message("Hook_ClientDisconnect(%d, %d, \"%s\", %lli)\n", slot, reason, pszName, xuid);
918+
919+
CCSPlayerController* player = CCSPlayerController::FromSlot(slot);
920+
if (player)
921+
ZR_CheckTeamWinConditions(player->m_iTeamNum == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T);
922+
else if (!ZR_CheckTeamWinConditions(CS_TEAM_T)) // If we cant get team num, just check both
923+
ZR_CheckTeamWinConditions(CS_TEAM_CT);
924+
918925
ZEPlayer* pPlayer = g_playerManager->GetPlayer(slot);
919926

920927
if (!pPlayer)

src/zombiereborn.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ extern double g_flUniversalTime;
5656
extern CConVar<int> g_cvarFreeArmor;
5757

5858
void ZR_Infect(CCSPlayerController* pAttackerController, CCSPlayerController* pVictimController, bool bBroadcast);
59-
bool ZR_CheckTeamWinConditions(int iTeamNum);
6059
void ZR_Cure(CCSPlayerController* pTargetController);
6160
void ZR_EndRoundAndAddTeamScore(int iTeamNum);
6261
void SetupCTeams();

src/zombiereborn.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,5 @@ AcquireResult ZR_Detour_CCSPlayer_ItemServices_CanAcquire(CCSPlayer_ItemServices
300300
void ZR_Detour_CEntityIdentity_AcceptInput(CEntityIdentity* pThis, CUtlSymbolLarge* pInputName, CEntityInstance* pActivator, CEntityInstance* pCaller, variant_t* value, int nOutputID);
301301
void ZR_Hook_ClientPutInServer(CPlayerSlot slot, char const* pszName, int type, uint64 xuid);
302302
void ZR_Hook_ClientCommand_JoinTeam(CPlayerSlot slot, const CCommand& args);
303-
void ZR_Precache(IEntityResourceManifest* pResourceManifest);
303+
void ZR_Precache(IEntityResourceManifest* pResourceManifest);
304+
bool ZR_CheckTeamWinConditions(int iTeamNum);

0 commit comments

Comments
 (0)