07.03.2014, 07:51
OnPlayerUpdate is not recommended. You may use a timer like this
PHP Code:
forward _UpdatePlayersStatus();
public OnGameModeInit()
{
SetTimer("_UpdatePlayersStatus", 1000, true);
return 1;
}
public _UpdatePlayersStatus()
{
new Float:plHealth;
for(new i = 0,j = GetMaxPlayers(); i < j; i ++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerHealth(i, plHealth);
if(plHealth <= 20)
{
ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
}
else if(plHealth >= 30)
{
SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
ClearAnimations(i);
}
}
}