OnPlayerTakeDamage
#1

Hi, I'm creating a gamemode right now, I added 10.0 additional damage to headshots, but the problem is when I shoot it sets the health to old hp - 10.0. So like if I have 80 hp, get shot in head from any weapon I'll have 70 hp. I've experienced this issue in other gamemode as well so there's nothing wrong with my gamemode.
Here's the code:
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
	if (issuerid != INVALID_PLAYER_ID)
	{
		if (bodypart == 9)
		{
			new Float:health, Float:armor;
			GetPlayerHealth(playerid, health);
			GetPlayerArmour(playerid, armor);
				
			if (armor > 10.0) SetPlayerArmour(playerid, armor - 10.0);
			else if (armor) SetPlayerArmour(playerid, 0.0);
			else if (health > 10.0) SetPlayerHealth(playerid, health - 10.0);
			else SetPlayerHealth(playerid, 0.0);
		}
	}
	return 1;
}
What's up with it? That's like getting the health before the player takes default SAMP damage. One way is just adding 10.0 to "amount" that is in the callback then take the amount from the player's health.
Reply


Messages In This Thread
OnPlayerTakeDamage - by GoldenLion - 11.09.2016, 19:09
Re: OnPlayerTakeDamage - by Logic_ - 11.09.2016, 19:26
Re: OnPlayerTakeDamage - by GoldenLion - 11.09.2016, 19:30
Re: OnPlayerTakeDamage - by PaulDinam - 11.09.2016, 21:34
Re: OnPlayerTakeDamage - by GoldenLion - 12.09.2016, 05:41

Forum Jump:


Users browsing this thread: 2 Guest(s)