Raised This Month: $319 Target: $400
 79%   Almost there!

register_event damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stigma
Senior Member
Join Date: Mar 2005
Location: Denmark
Old 06-12-2009 , 07:27   register_event damage
Reply With Quote #1

Hello.

How should i catch the "Damage" event? i'vre tryed using read_data(1) attempting to get the damage done, but without a result.

Edit

NVM, i found out that it is read_data(2) that i should use... Then another question, how come that it does not register all the damage that i do? if i hit a client serveral times, it only register the event few times

Last edited by stigma; 06-12-2009 at 07:38. Reason: Found solution
stigma is offline
Send a message via MSN to stigma Send a message via Skype™ to stigma
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-12-2009 , 08:52   Re: register_event damage
Reply With Quote #2

Use Ham_TakeDamage

PHP Code:
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" );

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage iBitDamage 
{   


__________________
Bugsy is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Location: Germany (GMT+1)
Old 06-12-2009 , 09:06   Re: register_event damage
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Use Ham_TakeDamage

PHP Code:
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" );

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage iBitDamage 
{   


Does that support wildcards btw? E.g. instead of "player" use "monster_*" ?
__________________
EAT YOUR VEGGIES
Silencer123 is offline
toazron1
Senior Member
Join Date: Oct 2006
Old 06-12-2009 , 09:13   Re: register_event damage
Reply With Quote #4

No it doesn't, if you want to hook everything that takes damage you need something like this: http://www.nsmod.org/forums/index.ph...=10179&hl=deli

I don't know of any non-NS equivalent
__________________
toazron1 is offline
Send a message via AIM to toazron1
stigma
Senior Member
Join Date: Mar 2005
Location: Denmark
Old 06-12-2009 , 13:35   Re: register_event damage
Reply With Quote #5

Okay thanks for the response, but as i dont know anything about that ham module, i dident ought to try. But i found out the with the damage event.
stigma is offline
Send a message via MSN to stigma Send a message via Skype™ to stigma
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-12-2009 , 13:47   Re: register_event damage
Reply With Quote #6

Here's a little example

PHP Code:
new g_MaxPlayers;
#define IsPlayer(%1)  ( 1 <= %1 <= g_MaxPlayers )

//plugin_init()
RegisterHamHam_TakeDamage "player" "fw_HamTakeDamage" );
g_MaxPlayers get_maxplayers();

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage iBitDamage 
{   
    if ( 
IsPlayeriAttacker ) )
     {
        static 
szName33 ];
        
get_user_nameiAttacker szName 32 );
        
client_printiVictim print_chat "You were attacked by %s" szName );
        
//You can block the victim from taking damage with: return HAM_SUPERCEDE;
    
}

__________________
Bugsy 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 07:18.


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