> > > >

cs_get_weapon_class | cstrike | AMX X Documentation

Includes

    1. Stocks
    1. Natives
    2. Forwards
    1. Natives
    2. Stocks
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    2. Forwards
    1. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Stocks
    1. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    1. Stocks
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Stocks
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Stocks
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Stocks

cs_get_weapon_class

Syntax
									stock CsWeaponClassType:cs_get_weapon_class(weapon_id)
									{
     new CsWeaponClassType:type = CS_WEAPONCLASS_NONE;

     if (cs_is_valid_itemid(weapon_id, .weapon_only = true) || weapon_id == CSI_SHIELD)
     {
          switch (weapon_id)
          {
               case CSI_SHIELDGUN, CSI_SHIELD: 
               {
                    type = CS_WEAPONCLASS_PISTOL;
               }
               case CSI_KNIFE: 
               {
                    type = CS_WEAPONCLASS_KNIFE;
               }
               default:
               {
                    new const bits = (1 << weapon_id);

                    if(bits & CSI_ALL_PISTOLS)
                    {
                         type = CS_WEAPONCLASS_PISTOL;
                    }
                    else if(bits & CSI_ALL_GRENADES)
                    {
                         type = CS_WEAPONCLASS_GRENADE;
                    }
                    else if(bits & CSI_ALL_SMGS)
                    {
                         type = CS_WEAPONCLASS_SUBMACHINEGUN;
                    }
                    else if(bits & CSI_ALL_SHOTGUNS)
                    {
                         type = CS_WEAPONCLASS_SHOTGUN;
                    }
                    else if(bits & CSI_ALL_MACHINEGUNS)
                    {
                         type = CS_WEAPONCLASS_MACHINEGUN;
                    }
                    else if(bits & CSI_ALL_RIFLES)
                    {
                         type = CS_WEAPONCLASS_RIFLE;
                    }
                    else if(bits & CSI_ALL_SNIPERRIFLES)
                    {
                         type = CS_WEAPONCLASS_SNIPERRIFLE;
                    }
               }
          }
     }

     return type;
}
								
Variable Description
weapon_id
Weapon id (CSI_* constants)

Description
Returns a weapon class id associated with a weapon id.

Return
Weapon class id (CS_WEAPONCLASS_* constants)
> > > >