Skip to content

Commit f465791

Browse files
JayCroghantilgep
authored andcommitted
Fixed Hook_ClientDisconnect calling ZR functions when not enabled (#404)
1 parent 01b5cea commit f465791

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/cs2fixes.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,14 @@ void CS2Fixes::Hook_ClientDisconnect(CPlayerSlot slot, ENetworkDisconnectionReas
950950
Message("Hook_ClientDisconnect(%d, %d, \"%s\", %lli)\n", slot, reason, pszName, xuid);
951951

952952
CCSPlayerController* player = CCSPlayerController::FromSlot(slot);
953-
if (player)
954-
ZR_CheckTeamWinConditions(player->m_iTeamNum == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T);
955-
else if (!ZR_CheckTeamWinConditions(CS_TEAM_T)) // If we cant get team num, just check both
956-
ZR_CheckTeamWinConditions(CS_TEAM_CT);
953+
954+
if (g_cvarEnableZR.Get())
955+
{
956+
if (player)
957+
ZR_CheckTeamWinConditions(player->m_iTeamNum == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T);
958+
else if (!ZR_CheckTeamWinConditions(CS_TEAM_T)) // If we cant get team num, just check both
959+
ZR_CheckTeamWinConditions(CS_TEAM_CT);
960+
}
957961

958962
ZEPlayer* pPlayer = g_playerManager->GetPlayer(slot);
959963

0 commit comments

Comments
 (0)