Why not using Engine?
PHP Code:
stock ham_strip_weapon(id, weapon[])
{
if(!equal(weapon,"weapon_",7))
return 0
new wId = get_weaponid(weapon)
if(!wId) return 0
new wEnt
while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}
if(!wEnt) return 0
if(get_user_weapon(id) == wId)
ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
return 0
ExecuteHamB(Ham_Item_Kill, wEnt)
entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<wId))
return 1
}
__________________