01.04.2011, 23:32
Its important that you set all cantspawn[playerid]=1 on playerconnect if the connecting players shouldn't spawn and play, if you don't want this forgott it. A must-do is to set cantspawn[playerid]=1 on playerdisconnect and on gamemodeinit
[QUOTE=JamesC;1147535]
[QUOTE=JamesC;1147535]
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
new j,klid;
for(new i=0; i < MAX_PLAYERS; i++) // Loop through players (foreach Recommended)
{
if(cantspawn[i] == 0) {j++; klid=i;} // If someone is alive, increase j by 1; Save playerid in klid.
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
{
// klid is the winner.
}
return 1;
}