Raised This Month: $ Target: $400
 0% 

Weapon change


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
misterx
Member
Join Date: Jan 2011
Old 05-08-2011 , 05:20   Weapon change
Reply With Quote #1

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(id1);

public 
cs_drop_slot(idweapon_id) {
    new 
weapons[32], weapons_num;
    
get_user_weapons(idweaponsweapons_num);
    for (new 
i=0i<=weapons_numi++) {
        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.
misterx is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode