cs_get_weapon_class
- Синтаксис
-
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; }
Переменная | Описание |
---|---|
weapon_id |
Weapon id (CSI_* constants) |
- Описание
- Returns a weapon class id associated with a weapon id.
- Возвращает
- Weapon class id (CS_WEAPONCLASS_* constants)