Im trying to make possible to play The Sacrifice finale with at least just 1 player (instead 2, just like L4D2 Mutation).
I get "Roundend blocked successful. Alive players: 1". But I still get error message on screen telling me "Mission failed. There must be at least 2 alive players" and round ends anyway.
It seems Plugin_Handled hasn't effect on "mission_lost" and "round_end".
PHP Code:
public OnPluginStart()
{
HookEvent("mission_lost", test_event, EventHookMode_Pre);
HookEvent("round_end", test_event, EventHookMode_Pre);
HookEvent("round_start", test_event, EventHookMode_Pre);
HookEvent("final_reportscreen", test_event);//never executed :(
}
public Action:test_event(Handle:event, const String:name[], bool:dontBroadcast)
{
//decl String:msg[256];
//GetEventString(event, "message", msg, 255);
//PrintToChatAll("Message: %s", msg);
new players = 0;
for (new i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i)) continue;
if (!IsPlayerAlive(i)) continue;
if ( !(GetClientTeam(i)==TEAM_SURVIVOR) ) continue;
players++;
}
if ( players>=1 )
{
PrintToChatAll("Roundend blocked successful. Alive players: %i", players);
return Plugin_Handled;
}
PrintToChatAll("Mission failed. Alive players: %i", players);
return Plugin_Continue;
}