Quote:
Originally Posted by rjjj
I did it ![Cheesy](images/smilies/biggrin.png) :
pawn Код:
//Put in the top of your gamemode:
new checking[MAX_PLAYERS]; new TimerHP; forward HealthLose(); forward HealthCheck();
//In the OnGameModeInit:
SetTimer("HealthCheck",2000,1);
//In the End of your gamemode:
public HealthCheck() { new Float:hp; for(new x=0; x<MAX_PLAYERS; x++) { if(IsPlayerConnected(x)) { GetPlayerHealth(x,hp); if(hp < 20.0) { GameTextForPlayer(x, "~g~You are ~r~hurt,go to ~y~cover~n~~h~", 6000, 6); TimerHP = SetTimerEx("HealthLose", 300000, 0, "i", x); checking[x] = 1; } } } }
public HealthLose() { for(new x=0; x<MAX_PLAYERS; x++) { new Float:Health; if(IsPlayerConnected(x)) { if(checking[x] == 1) { GetPlayerHealth(x,Health); SetPlayerHealth(x, Health - 5.0); KillTimer(TimerHP); checking[x] = 0; } } } }
I hope that i have helped ![Cheesy](images/smilies/biggrin.png)
|
For one, none of your timers returns a value(I'm pretty sure they should).
Also, I don't see why you'd have two timers running, when all you need is one. True, with my script the player may wait a minute before the notification showing up, but meh.