Raised This Month: $ Target: $400
 0% 

[SOLVED]How to detect damage/killed to entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
powwoww
BANNED
Join Date: Oct 2008
Old 11-26-2009 , 02:17   [SOLVED]How to detect damage/killed to entities
Reply With Quote #1

public plugin_init(){
register_plugin("DMG TEST","0.1","Flea")
RegisterHam(Ham_Killed, "func_breakable", "FwdHamBreakableKilled", 1 )
}
public FwdHamBreakableKilled(ent, killer ){
client_print(0,print_chat,"Break...")
}

I broke the glass in cs_assault, but nothing happened...
Could anybody please tell me how to make it?

Firippu are right , also thank Arkshine

Last edited by powwoww; 11-26-2009 at 06:45. Reason: solved
powwoww is offline
Firippu
Senior Member
Join Date: Jan 2007
Old 11-26-2009 , 03:27   Re: How to detect damage/killed to entities?
Reply With Quote #2

I don't think Ham_Killed works for entities.

this does what you want
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>

public plugin_init()
{
    
register_plugin("New Plugin","1.0","Unknown")
    
    
RegisterHam(Ham_TakeDamage,"func_breakable","FwdHamBreakableKilled",1)
}

public 
FwdHamBreakableKilled(ent)
{
    if(
entity_get_float(ent,EV_FL_health)<0)
    {
        
client_print(0,print_chat,"Break...")
    }

__________________
Firippu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-26-2009 , 03:55   Re: How to detect damage/killed to entities?
Reply With Quote #3

Weird Killed() is called from TakeDamage :

Code:
// do the damage     pev->health -= flDamage;     if (pev->health <= 0)     {         Killed( pevAttacker, GIB_NORMAL );         Die();         return 0;     }
__________________
Arkshine is offline
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 13:42.


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