Raised This Month: $ Target: $400
 0% 

hook when client kill someone?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2010 , 06:50   Re: hook when client kill someone?
Reply With Quote #2

DeathMsg is fine though.

PHP Code:
#include <amxmodx>

#define FIRST_PLAYER_ID    1

new g_iMaxPlayers
#define IsPlayer(%1)    ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

enum
{    
    
DeathMsg_KillerID 1// byte
    
DeathMsg_VictimID// byte
    
DeathMsg_IsHeadshot// byte
    
DeathMsg_TruncatedWeaponName // string
}

public 
plugin_init()
{
    
register_event("DeathMsg""Event_DeathMsg""a")

    
g_iMaxPlayers get_maxplayers()
}

//http://wiki.amxmodx.org/Half-Life_1_Game_Events#DeathMsg
public Event_DeathMsg()
{
    new 
iKiller read_data(DeathMsg_KillerID)
    if( 
IsPlayer(iKiller) )
    {
        new 
iVictim read_data(DeathMsg_VictimID)
        if( 
iKiller != iVictim )
        {
            new 
szKillerName[32], szVictimeName[32]
            
get_user_name(iKillerszKillerNamecharsmax(szKillerName))
            
get_user_name(iVictimszVictimeNamecharsmax(szVictimeName))
            new 
szWeaponName[10]
            
read_argv(DeathMsg_TruncatedWeaponNameszWeaponNamecharsmax(szWeaponName))
            
client_print(0print_chat"%s killed %s with %s %s"
                                
szKillerName
                                        
szVictimeName
                                            
szWeaponName
                                                
read_data(DeathMsg_IsHeadshot) ? "with HeadShot" "")
            
// iKiller killed iVictim
        
}
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-10-2010 at 06:54.
ConnorMcLeod is offline
 



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:09.


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