11.09.2016, 19:09
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:
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.
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; }