Hi,
I'm building a custom VIP weapon menu. It works fine, but if player selects the weapons he already has, it drops it. It works like this:
when a player selects a primary weapon, I run this function:
PHP Code:
cs_drop_slot(id, 1);
public cs_drop_slot(id, weapon_id) {
new weapons[32], weapons_num;
get_user_weapons(id, weapons, weapons_num);
for (new i=0; i<=weapons_num; i++) {
if (cs_weapon_level(weapons[i]) == weapon_id) {
client_cmd(id, "drop ^"%s^"", cs_weapon_id_to_name(weapons[i]));
}
}
}
cs_weapon_level converts weapon id to its slot, cs_weapon_id_to_name converts weapon id to its name (for example "weapon_awp").
But if I give user the same weapon it allready has, it will be droped. If someone needs the full code, I'll PM it, I really don't want to make this public.