AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Knife Kill (https://forums.alliedmods.net/showthread.php?t=159058)

extreem 06-12-2011 13:00

Knife Kill
 
HI all.
Can you tell me how I can hook knife or other weapon kill ?

fysiks 06-12-2011 13:15

Re: Knife Kill
 
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".

extreem 06-12-2011 13:19

Re: Knife Kill
 
I want give points for killer.
When he kill with knife - he got 2 points
when with other weapon - he got 1 point

fysiks 06-12-2011 13:56

Re: Knife Kill
 
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
    
}



extreem 06-12-2011 14:19

Re: Knife Kill
 
Thanks fysiks I will try it :)

extreem 06-12-2011 14:20

Re: Knife Kill
 
But can you tell me what is read_data(1), (2), (4)

NiHiLaNTh 06-12-2011 14:32

Re: Knife Kill
 
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.

extreem 06-12-2011 14:40

Re: Knife Kill
 
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 ?

fysiks 06-12-2011 15:00

Re: Knife Kill
 
Quote:

Note: TruncatedWeaponName doesn't contain a "weapon_" prefix. See CS Weapons Information for more information.

Devil259 06-12-2011 15:00

Re: Knife Kill
 
weapon_awp
weapon_ak47.


All times are GMT -4. The time now is 23:32.

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