Hp script
#7

Lol that's so prone to bugs.

Just create a variable:

pawn Код:
new bool:IsPlayerDowned[MAX_PLAYERS];
Reset it in OnPlayerConnect (so there's no issues between new players joining with old in-use ID's)

pawn Код:
IsPlayerDowned[playerid] = false;
Finally, in your OnPlayerUpdate:

pawn Код:
public OnPlayerUpdate(playerid)
{
      new Float:phealth;
      GetPlayerHealth(playerid,phealth);
      if(phealth <= 50 && IsPlayerDowned[playerid] = false)
      {
          //apply the fall animation
          TogglePlayerControllable(playerid,0);
          SendClientMessage(playerid,-1,"You have falled to the ground because you are injured");
          IsPlayerDowned[playerid] = true;
      }
      return 1;
}
When you want him to stand up again, just clear animations, set his HP to above 50 and set IsPlayerDowned[playerid] to false.
Reply


Messages In This Thread
Hp script - by N0FeaR - 09.01.2012, 00:22
Re: Hp script - by Tanush123 - 09.01.2012, 00:33
Re: Hp script - by N0FeaR - 09.01.2012, 00:58
Re: Hp script - by Tanush123 - 09.01.2012, 01:01
Re: Hp script - by N0FeaR - 09.01.2012, 01:26
Re: Hp script - by Tanush123 - 09.01.2012, 02:16
Re: Hp script - by Rob_Maate - 09.01.2012, 06:16
Re: Hp script - by N0FeaR - 09.01.2012, 06:39
Re: Hp script - by N0FeaR - 09.01.2012, 07:14
Re: Hp script - by N0FeaR - 09.01.2012, 15:34

Forum Jump:


Users browsing this thread: 1 Guest(s)