Raised This Month: $ Target: $400
 0% 

hook when client kill someone?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 07-10-2010 , 06:28   hook when client kill someone?
Reply With Quote #1

How do I hook when a client kills someone else. I do not want deathmsg, since that is when the person itself dies. I want to know when the client is killing someone...
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
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
Old 07-10-2010, 07:07
#8 SickneSS
This message has been deleted by #8 SickneSS. Reason: Connor post the same...
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 07-10-2010 , 08:05   Re: hook when client kill someone?
Reply With Quote #3

Thank you. That helped!
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
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:09.


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