YOU ARE HURT,GO TO COVER!
#2

Like this?

pawn Код:
// Somewhere in your script, not in a callback
new
    losehealth;

forward HealthCheck ( );

// OnPlayerConnect
SetTimer ( HealthCheck, 1, true );

// Behind the forward HealthCheck
public HealthCheck ( )
{
    for ( new i; i < MAX_PLAYERS; i ++ ) // You better use foreach
    {
        new
            Float: iHealth;
 
        GetPlayerHealth ( i, iHealth );
        if ( iHealth < 30.0 )
        {
            GameTextForPlayer ( i, "YOU ARE HURT,GO TO COVER", 3000, 3 );
            losehealth = SetTimer ( LoseHP, 60000, true );
        }
    }
    return 1;
}

forward LoseHP ( );
public LoseHP ( )
{
    for ( new i; i < MAX_PLAYERS; i ++ ) // You better use foreach
    {
        new
            Float: zHealth;

       GetPlayerHealth ( i, zHealth );

       if ( zHealth > 0 )
       {
           SetPlayerHealth ( i, zHealth - 5.0 );
       }
       else
       {
           KillTimer ( losehealth );
       }
   }
   return 1;
}
Like that?

* Basicz thinks that code will not work.
Reply


Messages In This Thread
YOU ARE HURT,GO TO COVER! - by Face9000 - 20.12.2010, 10:33
Re: YOU ARE HURT,GO TO COVER! - by Basicz - 20.12.2010, 10:52
Re: YOU ARE HURT,GO TO COVER! - by Face9000 - 20.12.2010, 10:57
Re: YOU ARE HURT,GO TO COVER! - by Basicz - 20.12.2010, 11:13
Re: YOU ARE HURT,GO TO COVER! - by CrucixTM - 20.12.2010, 11:13
Re: YOU ARE HURT,GO TO COVER! - by rjjj - 20.12.2010, 11:16
Re: YOU ARE HURT,GO TO COVER! - by CrucixTM - 20.12.2010, 11:19
Re: YOU ARE HURT,GO TO COVER! - by Face9000 - 20.12.2010, 11:21

Forum Jump:


Users browsing this thread: 2 Guest(s)