help please
#2

@ the top:
pawn Код:
forward dead( );
new deada[ MAX_PLAYERS ];
Will make a callback for the repeating timer and will check if player is dead

pawn Код:
public OnGameModeInit( )
{
    SetTimer( "dead", 5000, 1 );
    return 1;
}
Will start the timer to check if everyone is dead

pawn Код:
public OnPlayerDeath( playerid )
{
    deada[ playerid ] = 1;
    return 1;
}
pawn Код:
public OnPlayerSpawn( playerid )
{
    deada[ playerid ] = 0;
    return 1;
}
Will make the server know if player is dead or not.


pawn Код:
public dead( )
{
    new count = 0;
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( deada[ i ] == 0 )
        {
            count++;
        }
    }
    if( count == 0 )
    {
        for( new a = 0; a < MAX_PLAYERS; a++ )
        {
            if( IsPlayerConnected( a ) )
            {
                ForceClassSelection( a );
                SetPlayerHealth( a, 0.0 );
            }
        }
    }
    return 1;
}
If everyone is dead at the whole server, it will put them at class selection!
UNTESTED.
Reply


Messages In This Thread
help please - by bboytimix - 15.02.2011, 17:43
Re: help please - by Mean - 15.02.2011, 20:02
Re: help please - by bboytimix - 16.02.2011, 08:17
Re: help please - by bboytimix - 16.02.2011, 08:22
Re: help please - by bboytimix - 16.02.2011, 14:48
Re: help please - by Mean - 16.02.2011, 17:46
Re: help please - by bboytimix - 16.02.2011, 20:58

Forum Jump:


Users browsing this thread: 2 Guest(s)