Im trying to remove specific weapons that are dropped by players, but im having a hard time getting this to work. I get an error: "unknown entity 97", and I have no Idea whats wrong.... heres the code:
Code:
public handle_drop(id) {
if(!get_cvar_num(MOD))
return PLUGIN_HANDLED
new clip, ammo
new arsenal = get_user_weapon(id, clip, ammo)
if(arsenal == CSW_DEAGLE) {
new model[32]
new tEnt, oId, wEnt
tEnt = find_ent_by_class(-1, "weaponbox")
while(tEnt > 0) {
entity_get_string(tEnt, EV_SZ_model, model, 31)
if(equali(model, "models/w_deagle.mdl")) {
oId = entity_get_edict(tEnt, EV_ENT_owner)
if(oId > 0 && oId < 33) {
remove_entity(tEnt)
wEnt = find_ent_by_class(-1, "weapon_deagle")
while(wEnt > -1) {
oId = entity_get_edict(wEnt, EV_ENT_owner)
if(oId == tEnt)
remove_entity(wEnt)
}
}
}
}
return PLUGIN_CONTINUE
}
I used register_clcmd("drop","handle_drop") to catch a players drop. I don't know why this won't work. The server just crashes when I execute my plugin.... Thanks for the help.
-Knekter
__________________