Raised This Month: $ Target: $400
 0% 

Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 03-16-2009 , 10:45   Ham_TakeDamage
Reply With Quote #1

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?

Last edited by Spunky; 03-16-2009 at 10:47.
Spunky is offline
Send a message via AIM to Spunky
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-16-2009 , 10:51   Re: Ham_TakeDamage
Reply With Quote #2

Quote:
Originally Posted by Spunky View Post
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,
__________________

Last edited by Bugsy; 03-16-2009 at 10:54.
Bugsy is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 03-16-2009 , 11:51   Re: Ham_TakeDamage
Reply With Quote #3

Ah, thanks.
Spunky is offline
Send a message via AIM to Spunky
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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