Help Please Health change - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Please Health change (
/showthread.php?tid=109267)
Help Please Health change -
Cem - 19.11.2009
hi a little Help please thanks i want to make so when health drops it will do somthing i can only figure how to make it do somthing on change as i want it to do somthing when it drop's not when it goes back up this is my bit of code any help please thanks alot.
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:Life;
new Float:Oldhealth,Float:newhealth;
GetPlayerHealth(playerid, Life);
if (PlayerLife[playerid] != Life)
{
HealthChange(playerid, Oldhealth, newhealth);
PlayerLife[playerid] = Life;
}
return 1;
}
forward HealthChange(playerid, Float:Oldhealth, Float:newhealth);
public HealthChange(playerid, Float:Oldhealth, Float:newhealth)
{
// ill add my bit of code here! :D
return 1;
}
thanks for your help
Re: Help Please Health change -
BP13 - 19.11.2009
pff apparently not?
Re: Help Please Health change -
Cem - 19.11.2009
Quote:
Originally Posted by [SU
BP13 ]
Here's a snippet from Seif.
pawn Код:
new Float:PlayerHP[MAX_PLAYERS];
public OnPlayerConnect(playerid) { PlayerHP = 100.0; return 1; }
public OnPlayerUpdate(playerid) { new Float:hp; GetPlayerHealth(playerid, hp); if (PlayerHP[playerid] != hp) { OnPlayerHealthChange(playerid, oldhealth, newhealth); PlayerHP[playerid] = hp; } return 1; }
public OnPlayerHealthChange(playerid, Float:oldhealth, Float:newhealth) { // And with this, you can detect if a player's health has changed. return 1; }
|
so you cant help
Re: Help Please Health change -
Cem - 19.11.2009
BUMP
Re: Help Please Health change -
dice7 - 19.11.2009
You have the code right there
Re: Help Please Health change -
Cem - 19.11.2009
but when my health goes up it still does it i want it to only do it when health drops.
Re: Help Please Health change -
Cem - 20.11.2009
BUMP!
Re: Help Please Health change -
oncedead - 20.11.2009
pawn Код:
new Float:PlayerHP[MAX_PLAYERS];
forward OnPlayerHealthReduced(playerid, Float:hp);
public OnPlayerConnect(playerid)
{
PlayerHP = 100.0;
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:hp;
GetPlayerHealth(playerid, hp);
if (PlayerHP[playerid] > hp)
{
OnPlayerHealthChange(playerid, oldhealth, newhealth);
}
PlayerHP[playerid] = hp;
return 1;
}
public OnPlayerHealthReduced(playerid, Float:hp)
{
// And with this, you can detect if a player's health has changed.
return 1;
}
Now shut the hell up.
Re: Help Please Health change -
MenaceX^ - 20.11.2009
****** has a OnPlayerHealthChange & OnPlayerArmourChange in YUP.
I suggest you to use it.
Re: Help Please Health change -
ExoSanty - 21.11.2009
Quote:
Originally Posted by Tree of Fat
pawn Код:
new Float:PlayerHP[MAX_PLAYERS]; forward OnPlayerHealthReduced(playerid, Float:hp);
public OnPlayerConnect(playerid) { PlayerHP = 100.0; return 1; }
public OnPlayerUpdate(playerid) { new Float:hp; GetPlayerHealth(playerid, hp); if (PlayerHP[playerid] > hp) { OnPlayerHealthChange(playerid, oldhealth, newhealth); } PlayerHP[playerid] = hp; return 1; }
public OnPlayerHealthReduced(playerid, Float:hp) { // And with this, you can detect if a player's health has changed. return 1; }
Now shut the hell up.
|
correction: PlayerHP[playerid] = 100.0;
"Now shut the hell up." mlol