here add this to your code
prevent weapon pick up if is player g_Hasspartan[id]
and if player buy weapons after strip weapon will be switch automatic to knife
PHP Code:
public plugin_init()
{
register_forward(FM_Touch, "WeaponTouch")
register_event("CurWeapon", "ev_CheckWeapon", "be", "1=1")
}
PHP Code:
public WeaponTouch(ent, id)
{
if (is_user_alive(id) && g_Hasspartan[id])
{
new ClassName[32]
pev(ent, pev_classname, ClassName, 31)
if (equal(ClassName, "weaponbox") || equal(ClassName, "armoury_entity") || equal(ClassName, "grenade"))
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public ev_CheckWeapon(id)
{
static weapon_num
weapon_num = read_data(2)
if(is_user_alive(id) && g_Hasspartan[id])
{
if(weapon_num != CSW_KNIFE)
{
engclient_cmd(id, "weapon_knife")
}
}
}
__________________