20.12.2010, 10:52
Like this?
Like that?
* Basicz thinks that code will not work.
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;
}
* Basicz thinks that code will not work.