SHARE
TWEET

Untitled

a guest Sep 5th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     File: fn_getWeaponType.sqf
  3.     Author: blackfisch for Mountain Valley RPG
  4.     Credits: https://forums.bohemia.net/forums/topic/193019-can-i-detect-all-pistols-from-cfgweapons/
  5.  
  6.     Description:
  7.     Used in returning information about a vehicle from Config >> "CfgVehicles"
  8.  
  9.     Parameters:
  10.     _this select 0 - classname of the weapon
  11.  
  12.     Return:
  13.     ENUM - Type of Weapon (Pistol, Rifle, Launcher, Uniform, Vest, Goggle, Headgear, Backpack, OTHER if no weapon/equipment type or NONE if class not existing)
  14. */
  15. if !(params [
  16.     ["_class","",[""]]
  17. ]) exitWith {
  18.     diag_log "ERROR :: fn_getWeaponType.sqf - no classname provided";
  19.     systemChat "ERROR :: fn_getWeaponType.sqf - no classname provided";
  20. };
  21.  
  22. if (
  23.     !isClass(configFile >> "CfgWeapons" >> _class) &&
  24.     {!isClass(configFile >> "CfgVehicles" >> _class)} &&
  25.     {!isClass(configFile >> "CfgGlasses" >> _class)}
  26. ) exitWith { "NONE" };
  27.  
  28. private _base = [(configfile >> "CfgWeapons" >> _class),true] call BIS_fnc_returnParents;
  29.  
  30. if (_class isKindOf ["none",configfile >> "CfgGlasses"]) exitWith { "Goggle" };
  31. if (_class isKindOf ["Bag_Base", configFile >> "CfgVehicles"]) exitWith { "Backpack" };
  32. if (_class isKindOf ["Rifle", configFile >> "CfgWeapons"]) exitWith { "Rifle" };
  33. if (_class isKindOf ["Pistol", configFile >> "CfgWeapons"]) exitWith { "Pistol" };
  34. if (_class isKindOf ["Launcher", configFile >> "CfgWeapons"]) exitWith { "Launcher" };
  35. if ("Uniform_Base" in _base) exitWith { "Uniform" };
  36.  
  37. private _vests = [
  38.     "Vest_Camo_Base",
  39.     "Vest_NoCamo_Base"
  40. ];
  41. if (({_x in _base} count _vests) > 0 || {(_class find "FIR_SaftyVest_") > -1}) exitWith { "Vest" };
  42.  
  43. private _headgears = [
  44.     "H_HelmetB",
  45.     "HelmetBase"
  46. ];
  47. if (({_x in _base} count _headgears) > 0 || {(_class find "US_FireFighter_Helmet") > -1} || {(_class find "TRYK_H_" > -1)}) exitWith { "Headgear" };
  48.  
  49. //whatever it is now... possibly other items
  50. "Item";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top