Disabling weapon damage
#1

Is there a way to disable weapon damage? I tried returning false on OnPlayerGiveDamage or OnPlayerTakeDamage but none of them seem to work. I have also tried to re-set the player's HP to the current thus it will prevent damage from being applied, however sometimes when the player has like 10 HP and he gets shot with an M4 he'll die because the damage of it is usually more than 10 HP..
Reply
#2

Return 0 in OnPlayerWeaponShot - other damage like punching or fire can't be stopped, only re-setting the player's HP will work, but players with low HP will die.
Reply
#3

When I return 0 in OnPlayerWeaponShot both calls back GiveDamage and TakeDamage won't be called thus I can't tell which body part they actually shot :X
Reply
#4

pawn Код:
//Under OnPlayerTakeDamage//
new Float:m_health;
GetPlayerHealth(playerid, m_health);
SetPlayerHealth(playerid, m_health + amount);
return 1;
This will give them the health they lost.
Reply
#5

In OnPlayerTakeDamage, there's a float called amount, which is how much the player was damaged, therefore you can just set the player's health + amount.
pawn Код:
new Float:health, Float:armour; // Creates 2 floats, "health" and "armour"
GetPlayerHealth(playerid, health); // Stores the player's health value in the float "health"
GetPlayerArmour(playerid, armour); // Stores the player's armour value in the float "amour"
if(armour > 0) SetPlayerArmour(playerid, armour + amount); // Otherwise sets the players armour to his current armour, plus the damage that he took, removing the damage
else SetPlayerHealth(playerid, health + amount); // Otherwise sets the players health to his current health, plus the damage that he took, removing the damage
Although if he has very low health, he can still die from it before the script can set his health back.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)