Hello, I need some help. When I write 'pri' I must use 'attack2' once and then PrimaryAttack for knife is blocked, and it's the same with SecondaryAttack. Question, what I need to do, that when I write 'pri' PrimaryAttack should be [un]blocked at the time, and when I write 'sec' SecondaryAttack should be [un]blocked at the time too?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new bool: blocked[33]
public plugin_init()
{
register_clcmd("say toggle", "toggle")
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "Fwd_PrimaryAttack", 1)
RegisterHam(Ham_Item_Deploy, "weapon_knife", "Fwd_PrimaryAttack", 1)
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "Fwd_SecondaryAttack", 1)
RegisterHam(Ham_Item_Deploy, "weapon_knife", "Fwd_SecondaryAttack", 1)
}
public toggle(id)
blocked[id] = !blocked[id]
public Fwd_PrimaryAttack(Ent)
{
new id = get_pdata_cbase(Ent, 41, 4)
if (blocked[id])
set_pdata_float(Ent, 47, 9999.0, 4)
return HAM_IGNORED
}
public Fwd_SecondaryAttack(Ent)
{
new id = get_pdata_cbase(Ent, 41, 4)
if (!blocked[id])
set_pdata_float(Ent, 46, 9999.0, 4)
return HAM_IGNORED
}