Raised This Month: $ Target: $400
 0% 

Knife Kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 06-12-2011 , 13:00   Knife Kill
Reply With Quote #1

HI all.
Can you tell me how I can hook knife or other weapon kill ?
__________________
extreem is offline
Send a message via Skype™ to extreem
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-12-2011 , 13:15   Re: Knife Kill
Reply With Quote #2

There are a couple ways to do it. The method to use will depend on what you want to do with that information.

You can either hook Ham_Killed or hook the event "DeathMsg".
__________________
fysiks is online now
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 06-12-2011 , 13:19   Re: Knife Kill
Reply With Quote #3

I want give points for killer.
When he kill with knife - he got 2 points
when with other weapon - he got 1 point
__________________
extreem is offline
Send a message via Skype™ to extreem
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-12-2011 , 13:56   Re: Knife Kill
Reply With Quote #4

Something like this I believe:
PHP Code:
// plugin_init
    
register_event("DeathMsg""player_death""a","1>0")

public 
player_death(id)
{
    new 
killerid read_data(1)
    new 
victimid read_data(2)
    new 
szWeapon[20]; read_data(4szWeaponcharsmax(szWeapon));
    
    if( 
equal(szWeapon"knife") )
    {
        
// killerid killed victimid with a knife
    
}
    else
    {
        
// killerid killed victimid with something other than knife
    
}

__________________
fysiks is online now
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 06-12-2011 , 14:19   Re: Knife Kill
Reply With Quote #5

Thanks fysiks I will try it
__________________
extreem is offline
Send a message via Skype™ to extreem
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 06-12-2011 , 14:20   Re: Knife Kill
Reply With Quote #6

But can you tell me what is read_data(1), (2), (4)
__________________
extreem is offline
Send a message via Skype™ to extreem
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 06-12-2011 , 14:32   Re: Knife Kill
Reply With Quote #7

In this case - DeathMsg arguments.Look at DeathMsg structure - http://wiki.alliedmods.net/Half-Life...vents#DeathMsg.
Anyway, read_data is used to get event arguments, i.e. if you hook any event use this to get event arguments.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 06-12-2011 , 14:40   Re: Knife Kill
Reply With Quote #8

I can't find something about that
PHP Code:
if( equal(szWeapon"knife") ) 
Maybe must be as that ?
PHP Code:
if( equal(szWeapon"weapon_knife") ) 
how I can write awp ar ak47 ?
__________________

Last edited by extreem; 06-12-2011 at 14:48.
extreem is offline
Send a message via Skype™ to extreem
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-12-2011 , 15:00   Re: Knife Kill
Reply With Quote #9

Quote:
Note: TruncatedWeaponName doesn't contain a "weapon_" prefix. See CS Weapons Information for more information.
__________________
fysiks is online now
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-12-2011 , 15:00   Re: Knife Kill
Reply With Quote #10

weapon_awp
weapon_ak47.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Reply



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 23:32.


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