01.04.2011, 14:43
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
new j;
for(new i; i < MAX_PLAYERS; i++) // Loop through players (foreach Recommended)
{
if(cantspawn[i] == 0) j++; // If someone is alive, increase j by 1.
if(j > 1) break; // If j is more than 1, break loop (for efficiency)
}
if(j == 1) // Check that there is only 1 player alive
{
// killerid is the winner.
}
return 1;
}
EDIT: This will only work if the second last player is killed by the last player. If he died by falling etc, it wouldn't work. For that you would need to use a timer.