View Single Post
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