SA-MP Forums Archive
How i use onplayertakedamage? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How i use onplayertakedamage? (/showthread.php?tid=513830)



How i use onplayertakedamage? - Metharon - 18.05.2014

How can i create an system to set back the damage to health for admin?

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(AdminProtection[playerid] == 1) // If not self-inflicted
    {
      new Float:health;
      GetPlayerHealth(playerid,health);
      SetPlayerHealth(playerid, health + amount);
    }
    return 1;
}



Re: How i use onplayertakedamage? - Pottus - 18.05.2014

You don't need it for this, just use OnPlayerWeaponShot() and return 0; if the player has admin protection.