29.09.2017, 00:35
hello all i tried to make a damage based on body part by using OnPlayerTakeDamage. But when i shoot/hit a player. Their hp stays 100 again! Any help is appreciated.
Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) { new Float:armour; GetPlayerArmour(playerid,armour); new Float:hpplayer; GetPlayerHealth(playerid,hpplayer); if(armour>0) { if(bodypart==9) { new Float:hpamount,Float:amamount,Float:sethp,Float:setam; amamount=(amount/100)*25; hpamount=(amount/100)*75; sethp=hpplayer-hpamount; setam=armour-amamount; SetPlayerArmour(playerid,setam); SetPlayerHealth(playerid,sethp); } if(bodypart==3 || bodypart==4) { new Float:hpamount,Float:amamount,Float:sethp,Float:setam; amamount=(amount/100)*50; hpamount=(amount/100)*50; sethp=hpplayer-hpamount; setam=armour-amamount; SetPlayerArmour(playerid,setam); SetPlayerHealth(playerid,sethp); } if(bodypart==5 || bodypart==6 || bodypart==7 || bodypart==8) { new Float:sethp; sethp=hpplayer-((amount/4)*3); SetPlayerHealth(playerid,sethp); } } else { if(bodypart==9) { new Float:sethp; sethp=hpplayer-(((amount/4)*3)+amount); SetPlayerHealth(playerid,sethp); } if(bodypart==3 || bodypart==4) { new Float:sethp; sethp=hpplayer-((amount/4)+amount); SetPlayerHealth(playerid,sethp); } if(bodypart==5 || bodypart==6 || bodypart==7 || bodypart==8) { new Float:sethp; sethp=hpplayer-((amount/4)*3); SetPlayerHealth(playerid,sethp); } } return 1; }