10.10.2013, 01:21
Quote:
pawn Код:
|
pawn Код:
new Float:hp;
GetPlayerHealth(playerid,hp);
hp -= amount;
I wouldn't use timers like you are instead I would create a timer which loops through all players instead of making a bunch of individual timers that is very sloppy and messy so you would get something like this.
pawn Код:
new Injured[MAX_PLAYERS];
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(!Injured[playerid])
{
new Float:hp;
GetPlayerHealth(playerid,hp);
hp -= amount;
if(hp <= 20)
{
TogglePlayerControllable (playerid,0);
ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
Injured[playerid] = 1;
}
}
return 1;
}
pawn Код:
public OnGameModeInit()
{
SetTimer("InjuredTimer", 4000, true);
return 1;
}
pawn Код:
forward InjuredTimer();
public InjuredTimer()
{
foreach(new i : Player)
{
if(Injured[i])
{
new Float:hp;
GetPlayerHealth(i, hp);
if(hp <= 20.0) SetPlayerHealth(i, hp-1.0);
else
{
TogglePlayerControllable(i,1);
Injured[i] = 0;
}
}
}
}