Source2ZE/CS2Fixes

Kicking last zombie prevents round from ending

Frozen-H2O opened this issue · 1 comments

If the last living zombie is kicked from the server after zombie respawning is disabled, the round will not end.
Presumably the same thing will happen when the last zombie simply disconnects without a kick, but I did not test if that happened.

CS2Fixes/src/zombiereborn.cpp

Lines 1595 to 1602 in ba6f83d

CCSPlayerController *pVictimController = (CCSPlayerController*)pEvent->GetPlayerController("userid");
if (!pVictimController)
return;
CCSPlayerPawn *pVictimPawn = (CCSPlayerPawn*)pVictimController->GetPawn();
if (!pVictimPawn)
return;
ZR_CheckTeamWinConditions(pVictimPawn->m_iTeamNum() == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T);

They fail the null checks, but we also need pawn to get the team.

Ice:
"If disconnects dont give team info, why not just check both teams' win conditions when there is no controller/pawn? and if first win check for ZMs returns true, just skip the CTs' win check (in case everyone is dead)"