SA-MP Forums Archive
On Player 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: On Player Health Change (/showthread.php?tid=261422)



On Player Health Change - aqu - 13.06.2011

Hello,am using: http://forum.sa-mp.com/archive/index.php/t-59771.html
So I addited to my gamemode public OnPlayerHealthChange(playerid, Float:newhealth, Floatldhealth).

So I addited this stuf:
Код:
public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
{
 if(safezone[playerid] == 1)
 {
	if(oldhealth > newhealth || oldhealth < newhealth)
	{
	  SetPlayerHealth(playerid,oldhealth);
	  SafeTimer = SetTimer("KillProtectionTimer",10000,false);
	}
 }
 return 1;
}
I want if player ,which has safezone = 1,when his health gets lower,it will give back old heath.
When I enter checkpoint it gives 1hp.Where is the problem?


Re: On Player Health Change - Skaizo - 13.06.2011

Код:
public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
{
 if(safezone[playerid] == 1)
 {
	if(oldhealth > newhealth || oldhealth < newhealth)
	{
	  SetPlayerHealth(playerid,newhealth);
	  SafeTimer = SetTimer("KillProtectionTimer",10000,false);
	}
 }
 return 1;
}
or
Код:
public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
{
 if(safezone[playerid] == 100)
 {
	if(oldhealth > newhealth || oldhealth < newhealth)
	{
	  SetPlayerHealth(playerid,newhealth);
	  SafeTimer = SetTimer("KillProtectionTimer",10000,false);
	}
 }
 return 1;
}