AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_TakeDamage (https://forums.alliedmods.net/showthread.php?t=87783)

Spunky 03-16-2009 10:45

Ham_TakeDamage
 
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?

Bugsy 03-16-2009 10:51

Re: Ham_TakeDamage
 
Quote:

Originally Posted by Spunky (Post 781864)
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,


Spunky 03-16-2009 11:51

Re: Ham_TakeDamage
 
Ah, thanks.


All times are GMT -4. The time now is 09:00.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.