PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <orpheu>
#include <hamsandwich>
const m_pPlayer = 41
const m_iId = 43
const XoWeapon = 4
enum
{
KNIFE_IDLE,
KNIFE_ATTACK1HIT,
KNIFE_ATTACK2HIT,
KNIFE_DRAW,
KNIFE_STABHIT,
KNIFE_STABMISS,
KNIFE_MIDATTACK1HIT,
KNIFE_MIDATTACK2HIT,
KNIFE_INSPECT
}
public plugin_init()
{
register_forward(FM_UpdateClientData, "pfnUpdateClientData", true)
OrpheuRegisterHook(OrpheuGetFunctionFromClass("weapon_knife", "SendWeaponAnim", "CBasePlayerWeapon"), "OnSendWeaponAnim", OrpheuHookPre)
}
public pfnUpdateClientData(id, SendWeapons, CD_Handle)
{
if(is_user_alive(id) && SendWeapons)
{
if(get_user_weapon(id) == CSW_KNIFE)
{
set_cd(CD_Handle, CD_ID, 0);
}
}
}
public OrpheuHookReturn:OnSendWeaponAnim(WeaponEntity, Animation, SkipLocal)
{
if(pev_valid(WeaponEntity))
{
new id = get_pdata_cbase(WeaponEntity, m_pPlayer, XoWeapon)
if(is_user_alive(id))
{
new WeaponIndex = get_pdata_int(WeaponEntity, m_iId, XoWeapon)
if(WeaponIndex != CSW_KNIFE)
{
return OrpheuIgnored
}
if(Animation != KNIFE_DRAW)
{
SendWeaponAnim(id, Animation)
}
return OrpheuSupercede
}
}
return OrpheuIgnored
}
SendWeaponAnim(id, Animation)
{
set_pev(id, pev_weaponanim, Animation)
message_begin(MSG_ONE, SVC_WEAPONANIM, _, id)
{
write_byte(Animation)
write_byte(0)
message_end()
}
}
Didn't test, but maybe it will work, give it a try.
Code:
{
"name" : "SendWeaponAnim",
"class" : "CBasePlayerWeapon",
"library" : "mod",
"arguments" :
[
{
"type" : "int"
},
{
"type" : "int"
}
],
"indexes" :
[
{
"os" : "windows",
"mod" : "cstrike",
"value" : 85
},
{
"os" : "linux",
"mod" : "cstrike",
"value" : 87
}
]
}
Put this in
\configs\orpheu\virtualFunctions\CBasePlayerW eapon
__________________