Quote:
Originally Posted by Spunky
What's the difference between the inflictor_id and attacker_id arguments when hooking? Which should you use to detect if an entity is behind the damage?
Would I use:
Code:
if (inflictor_id == find_ent_by_class(-1, "trigger_hurt"))
or:
Code:
if (attacker_id == find_ent_by_class(-1, "trigger_hurt"))
And I'm also not sure about find_ent_by_class, is that an accurate use of it?
|
To check if player you can use:
PHP Code:
#define IsPlayer(%1) (1<=%1<=32)
Code:
/**
* Description: Usually called whenever an entity takes any kind of damage.
* Inflictor is the entity that caused the damage (such as a gun).
* Attacker is the entity that tirggered the damage (such as the gun's owner).
* Forward params: function(this, idinflictor, idattacker, Float:damage, damagebits);
* Return type: Integer.
* Execute params: ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits);
*/
Ham_TakeDamage,
__________________