Raised This Month: $51 Target: $400
 12% 

Detect entity damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 01-12-2012 , 07:20   Detect entity damage
Reply With Quote #1

How can I detect when a custom entity ( by custom I mean that I gave it non stock CS classname ) takes damage from a a player's weapon?
I've tried hooking Ham_TakeDamage which gives an error saying that the hook was not active. So instead I tried registering it after the entity was created, but the same error was given.
What other ways can I do this? ( Please note that the entity is SOLID_TRIGGER. )

Obviously for grenades I can hook the explosion and find in sphere but surely theres a better way that will cover all kinds of damage.

Thanks.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
fLaXXiE.
Member
Join Date: Jan 2012
Old 01-12-2012 , 08:18   Re: Detect entity damage
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?p=789735 - Here ya' go!
- But please try seaching before asking for help, hope this is correct.
__________________
Currently working public plugins; Will be released, stop asking!
PM me for private work; i will look your message when i have time.

Public plugins by me:
Achievements ( 100% )
Jailbreak Glow Menu ( 100% )
fLaXXiE. is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 01-12-2012 , 08:31   Re: Detect entity damage
Reply With Quote #3

Next time I'd prefer not to be asked to try searching when I've already done so, tried other suggested methods and failed, and what you posted is completely different.

I just need to hook the damage on my entity, not a player, and not necessarily the damage amount. But thanks for trying anyway.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
MyPc
Senior Member
Join Date: Sep 2011
Old 01-13-2012 , 05:49   Re: Detect entity damage
Reply With Quote #4

Quote:
Originally Posted by hornet View Post
Next time I'd prefer not to be asked to try searching when I've already done so, tried other suggested methods and failed, and what you posted is completely different.

I just need to hook the damage on my entity, not a player, and not necessarily the damage amount. But thanks for trying anyway.
Code:
RegisterHam(Ham_TraceAttack, "entity_classname", "CallBack", 0) // 1 or 0 depends what you need
MyPc is offline
Reply



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 20:34.


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