20.06.2013, 15:37
Is there any function which tells that is there any player alive in the server. I mean in "no respawn dm" all players are dead and wins only one player who is still alive.
new Float:health; GetPlayerHealth( playerid,health ); if ( health >= 0.0 ) { SetClientMessage( playerid, -1, "Player is alive!!!" ); }
SetTimerEx("OnServerUpdate", 1, true);
public OnServerUpdate()
{
new count=0;
for(new i; i < MAX_PLAYERS; i++)
{
new Float:hp;
GetPlayerHealth(i, hp);
if(hp > 1.0)
{ count++; }
}
if(count > 1)
{
// DO your coding here
}
//if you need this code i mentioned above, so for your info. this will detect if there is only one player alive
if(count == 1)
{
// DO your coding here
}
return 1;
}