AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is there any function can hook the knife attack event? (https://forums.alliedmods.net/showthread.php?t=93442)

mwy5ym 05-28-2009 22:48

Is there any function can hook the knife attack event?
 
I need this kind of function, which likes the following functions.
forward client_damage(attacker,victim,damage,wpnindex ,hitplace,TA);
forward client_death(killer,victim,wpnindex,hitplace, TK);
forward grenade_throw( index,greindex,wId );
or it can just like the gun shoot event(http://forums.alliedmods.net/showthread.php?t=54887)
but the gun shoot plugin can not get the knife attack.

I need to get the client id when he is attacking by knife, and do not care if this attack will or not take any damages.(if can get the attack type will be better, I mean the type as: the knife attack is a fast slight attack(usually caused by left click) or a slow pained attack(usually caused by right click))

Overlook my poor english, and I'd appreciate any help you could give me.

joaquimandrade 05-28-2009 22:52

Re: Is there any function can hook the knife attack event?
 
PHP Code:


#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_Weapon_PrimaryAttack,"weapon_knife","knifeAttack")
    
RegisterHam(Ham_Weapon_SecondaryAttack,"weapon_knife","knifeAttack")
}

public 
knifeAttack(knifeID)
{
    




All times are GMT -4. The time now is 13:59.

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