Hp script
#8

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
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.
i get this then mabye help

Код:
C:\Users\Robin\Desktop\New rp\gamemodes\RMRP.pwn(85578) : error 001: expected token: ";", but found ")"
C:\Users\Robin\Desktop\New rp\gamemodes\RMRP.pwn(85578) : error 029: invalid expression, assumed zero
C:\Users\Robin\Desktop\New rp\gamemodes\RMRP.pwn(85578) : fatal error 107: too many error messages on one line
Код:
new Float:phealth;
	GetPlayerHealth(playerid,phealth);
line 85578	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;
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)