20.12.2010, 11:16
I did it :
I hope that i have helped
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