Checking if there is someone alive.
#2

new bool:Alive[MAX_PLAYERS] = {true,...};

OnPlayerConnect:

Alive[playerid]=true;

OnPlayerDisconnect

Alive[playerid] = false;

OnPlayerDeath

Alive[playerid] = false;


Where u want to check

new alives = 0;
for ( new i = 0 , j = GetMaxPlayers( ) ; i < j ; ++ i ) {
if( ! IsPlayerConnected( i ) ) continue;
if( Alive[ i ] == false ) continue;
alives ++;
}

if ( alives == 1 ) {
SendClientMessageToAll( -1 , "one is alive" );
}
Reply


Messages In This Thread
Checking if there is someone alive. - by ValentinLaw - 18.08.2012, 22:32
Re: Checking if there is someone alive. - by ReVo_ - 18.08.2012, 22:39
Re: Checking if there is someone alive. - by Larceny - 18.08.2012, 22:51
Re: Checking if there is someone alive. - by Youice - 18.08.2012, 23:44
Re: Checking if there is someone alive. - by ValentinLaw - 21.08.2012, 18:39
Re: Checking if there is someone alive. - by Finn - 21.08.2012, 19:52

Forum Jump:


Users browsing this thread: 1 Guest(s)