No. No no no. Stop that. Bad. *grabs a newspaper*
CS_OnTerminateRound fires... wait for it... when you call CS_TerminateRound. What happens when you call CS_TerminateRound inside of CS_OnTerminateRound! Infinite loopage! What happens when you repeat that infinite loop inside of another loop? Infinite loopage! What event fires after CS_TerminateRound is called? round_end. Infinite loopage! As you can see, this is all bad.
Since you're having difficulties:
PHP Code:
public Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason)
{
//This has priority, it won't fire unless the round is starting or something bad happened and it has to restart the round.
if(reason == CSRoundEnd_GameStart)
return Plugin_Continue;
//Was a reason other than CT win passed? If so, we gotta fix that shit.
if(reason != CSRoundEnd_CTWin)
{
new iLivingBlues;
for(new i = 1; i <= MaxClients; i++)
{
//Not ingame? Don't care. Not on CT? Don't care. Dead? Don't care.
if(!IsClientInGame(i) || GetClientTeam(i) != CS_TEAM_CT || !IsPlayerAlive(i))
continue;
iLivingBlues++;
}
//If there are any living CTs, make them the winner
if(iLivingBlues)
{
reason = CSRoundEnd_CTWin;
return Plugin_Changed;
}
}
return Plugin_Continue;
}
Of course this assumes the round ends naturally. If it doesn't, you'll have to handle that elsewhere. And on a re-read, this sounds very condescending, I apologize as that wasn't intentional. Need to work on my humor...
__________________