On Player Health Change
#1

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?
Reply
#2

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)