Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: fn_getWeaponType.sqf
- Author: blackfisch for Mountain Valley RPG
- Credits: https://forums.bohemia.net/forums/topic/193019-can-i-detect-all-pistols-from-cfgweapons/
- Description:
- Used in returning information about a vehicle from Config >> "CfgVehicles"
- Parameters:
- _this select 0 - classname of the weapon
- Return:
- ENUM - Type of Weapon (Pistol, Rifle, Launcher, Uniform, Vest, Goggle, Headgear, Backpack, OTHER if no weapon/equipment type or NONE if class not existing)
- */
- if !(params [
- ["_class","",[""]]
- ]) exitWith {
- diag_log "ERROR :: fn_getWeaponType.sqf - no classname provided";
- systemChat "ERROR :: fn_getWeaponType.sqf - no classname provided";
- };
- if (
- !isClass(configFile >> "CfgWeapons" >> _class) &&
- {!isClass(configFile >> "CfgVehicles" >> _class)} &&
- {!isClass(configFile >> "CfgGlasses" >> _class)}
- ) exitWith { "NONE" };
- private _base = [(configfile >> "CfgWeapons" >> _class),true] call BIS_fnc_returnParents;
- if (_class isKindOf ["none",configfile >> "CfgGlasses"]) exitWith { "Goggle" };
- if (_class isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) exitWith { "Backpack" };
- if (_class isKindOf ["Rifle", configFile >> "CfgWeapons"]) exitWith { "Rifle" };
- if (_class isKindOf ["Pistol", configFile >> "CfgWeapons"]) exitWith { "Pistol" };
- if (_class isKindOf ["Launcher", configFile >> "CfgWeapons"]) exitWith { "Launcher" };
- if ("Uniform_Base" in _base) exitWith { "Uniform" };
- private _vests = [
- "Vest_Camo_Base",
- "Vest_NoCamo_Base"
- ];
- if (({_x in _base} count _vests) > 0 || {(_class find "FIR_SaftyVest_") > -1}) exitWith { "Vest" };
- private _headgears = [
- "H_HelmetB",
- "HelmetBase"
- ];
- if (({_x in _base} count _headgears) > 0 || {(_class find "US_FireFighter_Helmet") > -1} || {(_class find "TRYK_H_" > -1)}) exitWith { "Headgear" };
- //whatever it is now... possibly other items
- "Item";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement