Advertisement
Guest User

Untitled

a guest
Feb 27th, 2021
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. /*
  2. File: fn_accType.sqf
  3. Author: TAW_Tonic
  4.  
  5. Description:
  6. Checks what type of an attachment is passed and what it is compatible with.
  7.  
  8. Returns:
  9. 0: Unknown Error
  10. 1: Primary
  11. 2: Secondary
  12. 3: Handgun
  13. */
  14. private["_item","_type","_tmp","_ret","_arr"];
  15. _item = [_this,0,"",[""]] call BIS_fnc_param;
  16. _type = [_this,1,0,[0]] call BIS_fnc_param;
  17. if(_item == "" || _type == 0) exitWith {0};
  18. _ret = 0;
  19. _item = toLower(_item);
  20.  
  21. switch (_type) do
  22. {
  23. case 201:
  24. {
  25. //Pistol first
  26. if(handgunWeapon player != "") then
  27. {
  28. _tmp = [(handgunWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  29. _arr = _tmp select 11;
  30. if(count _arr != 0) then
  31. {
  32. for "_i" from 0 to (count _arr)-1 do
  33. {
  34. _arr set[_i,toLower(_arr select _i)];
  35. };
  36. if(_item in _arr) then {_ret = 3;};
  37. };
  38. };
  39.  
  40. //Secondary
  41. if(secondaryWeapon player != "") then
  42. {
  43. _tmp = [(secondaryWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  44. _arr = _tmp select 11;
  45. if(count _arr != 0) then
  46. {
  47. for "_i" from 0 to (count _arr)-1 do
  48. {
  49. _arr set[_i,toLower(_arr select _i)];
  50. };
  51. if(_item in _arr) then {_ret = 2;};
  52. };
  53. };
  54.  
  55. //Primary
  56. if(primaryWeapon player != "") then
  57. {
  58. _tmp = [(primaryWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  59. _arr = _tmp select 11;
  60. if(count _arr != 0) then
  61. {
  62. for "_i" from 0 to (count _arr)-1 do
  63. {
  64. _arr set[_i,toLower(_arr select _i)];
  65. };
  66. if(_item in _arr) then {_ret = 1;};
  67. };
  68. };
  69. };
  70.  
  71. case 301:
  72. {
  73. //Pistol first
  74. if(handgunWeapon player != "") then
  75. {
  76. _tmp = [(handgunWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  77. _arr = _tmp select 10;
  78. if(count _arr != 0) then
  79. {
  80. for "_i" from 0 to (count _arr)-1 do
  81. {
  82. _arr set[_i,toLower(_arr select _i)];
  83. };
  84. if(_item in _arr) then {_ret = 3;};
  85. };
  86. };
  87.  
  88. //Secondary
  89. if(secondaryWeapon player != "") then
  90. {
  91. _tmp = [(secondaryWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  92. _arr = _tmp select 10;
  93. if(count _arr != 0) then
  94. {
  95. for "_i" from 0 to (count _arr)-1 do
  96. {
  97. _arr set[_i,toLower(_arr select _i)];
  98. };
  99. if(_item in _arr) then {_ret = 2;};
  100. };
  101. };
  102.  
  103. //Primary
  104. if(primaryWeapon player != "") then
  105. {
  106. _tmp = [(primaryWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  107. _arr = _tmp select 10;
  108. if(count _arr != 0) then
  109. {
  110. for "_i" from 0 to (count _arr)-1 do
  111. {
  112. _arr set[_i,toLower(_arr select _i)];
  113. };
  114. if(_item in _arr) then {_ret = 1;};
  115. };
  116. };
  117. };
  118.  
  119. case 101:
  120. {
  121. //Pistol first
  122. if(handgunWeapon player != "") then
  123. {
  124. _tmp = [(handgunWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  125. _arr = _tmp select 12;
  126. if(count _arr != 0) then
  127. {
  128. for "_i" from 0 to (count _arr)-1 do
  129. {
  130. _arr set[_i,toLower(_arr select _i)];
  131. };
  132. if(_item in _arr) then {_ret = 3;};
  133. };
  134. };
  135.  
  136. //Secondary
  137. if(secondaryWeapon player != "") then
  138. {
  139. _tmp = [(secondaryWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  140. _arr = _tmp select 12;
  141. if(count _arr != 0) then
  142. {
  143. for "_i" from 0 to (count _arr)-1 do
  144. {
  145. _arr set[_i,toLower(_arr select _i)];
  146. };
  147. if(_item in _arr) then {_ret = 2;};
  148. };
  149. };
  150.  
  151. //Primary
  152. if(primaryWeapon player != "") then
  153. {
  154. _tmp = [(primaryWeapon player),"CfgWeapons"] call life_fnc_fetchCfgDetails;
  155. _arr = _tmp select 12;
  156. if(count _arr != 0) then
  157. {
  158. for "_i" from 0 to (count _arr)-1 do
  159. {
  160. _arr set[_i,toLower(_arr select _i)];
  161. };
  162. if(_item in _arr) then {_ret = 1;};
  163. };
  164. };
  165. };
  166. };
  167.  
  168. _ret;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement