17.02.2011, 11:08
At the top:
At OnGameModeInit
anywhere:
at OnPlayerConnect
I hope that helped you and it works how you wanted it..
I just wrote it up so I don't know whether there is any error in it.. if there is, please tell me...
(you can also use SetTimerEx, but I wouldn't advice to do so..)
pawn Код:
new hfroze[MAX_PLAYERS];
forward HealthCheck();
pawn Код:
SetTimer("HealthCheck", 2000, true);
pawn Код:
public HealthCheck()
{
new Float:health;
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(hfroze[i] == 1)
{
GetPlayerHealth(i, health);
SetPlayerHealth(i, health+2);
if(health >= 15)
{
TogglePlayerControllable(i, 1);
hfroze = 0;
}
}else{
GetPlayerHealth(i, health);
if(health < 15)
{
hfroze = 1;
TogglePlayerControllable(i, 0);
SendClientMessage(i, 0x999999AA, "Wait until your health increased to over 15hp");
}
}
}
}
return 1;
}
pawn Код:
hfroze[playerid] = 0;
I just wrote it up so I don't know whether there is any error in it.. if there is, please tell me...
(you can also use SetTimerEx, but I wouldn't advice to do so..)