12.07.2011, 11:38
Looks wrong still:
the playerid parameter isn't used, I'd suggest removing the for loop if you're going to use settimerex... After that, yeah should be much better.
pawn Код:
forward HPreg(playerid);
public HPreg(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
new Float:pHealth;
GetPlayerHealth(i, pHealth);
if(pHealth < 100) SetPlayerHealth(i, pHealth +1); // regenerates +1 hp per 1,000 ms
if(pHealth < 30) GameTextForPlayer(i,"~r~Find some cover before taking more damage!",3000,3); // announcing that you have low health while regenerating
if(pHealth > 100)
{
SetPlayerHealth(i, 100); //Reset player health when health is full
}
}
}
}