Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. /*
  2. File: fn_saveGear.sqf
  3. Author: Bryan "Tonic" Boardwine
  4. Full Gear/Y-Menu Save by Vampire
  5. Edited: Itsyuka
  6.  
  7. Description:
  8. Saves the players gear for syncing to the database for persistence..
  9. */
  10. private["_return","_uItems","_bItems","_vItems","_pItems","_hItems","_yItems","_uMags","_vMags","_bMags","_pMag","_hMag","_uni","_ves","_bag","_handled"];
  11. _return = [];
  12.  
  13. _return pushBack uniform player;
  14. _return pushBack vest player;
  15. _return pushBack backpack player;
  16. _return pushBack goggles player;
  17. _return pushBack headgear player;
  18. _return pushBack assignedITems player;
  19. if(playerSide == west || playerSide == civilian || playerSide == east && {(call life_save_civ)}) then {
  20. _return pushBack primaryWeapon player;
  21. _return pushBack handgunWeapon player;
  22. } else {
  23. _return pushBack [];
  24. _return pushBack [];
  25. };
  26.  
  27. _uItems = [];
  28. _uMags = [];
  29. _bItems = [];
  30. _bMags = [];
  31. _vItems = [];
  32. _vMags = [];
  33. _pItems = [];
  34. _hItems = [];
  35. _yItems = [];
  36. _uni = [];
  37. _ves = [];
  38. _bag = [];
  39.  
  40. if(uniform player != "") then
  41. {
  42. {
  43. if (_x in (magazines player)) then {
  44. _uMags = _uMags + [_x];
  45. } else {
  46. _uItems = _uItems + [_x];
  47. };
  48. } forEach (uniformItems player);
  49. };
  50.  
  51. if(backpack player != "") then
  52. {
  53. {
  54. if (_x in (magazines player)) then {
  55. _bMags = _bMags + [_x];
  56. } else {
  57. _bItems = _bItems + [_x];
  58. };
  59. } forEach (backpackItems player);
  60. };
  61.  
  62. if(vest player != "") then
  63. {
  64. {
  65. if (_x in (magazines player)) then {
  66. _vMags = _vMags + [_x];
  67. } else {
  68. _vItems = _vItems + [_x];
  69. };
  70. } forEach (vestItems player);
  71. };
  72.  
  73. if(count (primaryWeaponMagazine player) > 0 && alive player) then
  74. {
  75. _pMag = ((primaryWeaponMagazine player) select 0);
  76. if(_pMag != "") then
  77. {
  78. _uni = player canAddItemToUniform _pMag;
  79. _ves = player canAddItemToVest _pMag;
  80. _bag = player canAddItemToBackpack _pMag;
  81. _handled = false;
  82. if(_ves) then
  83. {
  84. _vMags = _vMags + [_pMag];
  85. _handled = true;
  86. };
  87. if(_uni && !_handled) then
  88. {
  89. _uMags = _uMags + [_pMag];
  90. _handled = true;
  91. };
  92. if(_bag && !_handled) then
  93. {
  94. _bMags = _bMags + [_pMag];
  95. _handled = true;
  96. };
  97. };
  98. };
  99.  
  100. if(count (handgunMagazine player) > 0 && alive player) then
  101. {
  102. _hMag = ((handgunMagazine player) select 0);
  103. if(_hMag != "") then
  104. {
  105. _uni = player canAddItemToUniform _hMag;
  106. _ves = player canAddItemToVest _hMag;
  107. _bag = player canAddItemToBackpack _hMag;
  108. _handled = false;
  109. if(_ves) then
  110. {
  111. _vMags = _vMags + [_hMag];
  112. _handled = true;
  113. };
  114. if(_uni && !_handled) then
  115. {
  116. _uMags = _uMags + [_hMag];
  117. _handled = true;
  118. };
  119. if(_bag && !_handled) then
  120. {
  121. _bMags = _bMags + [_hMag];
  122. _handled = true;
  123. };
  124. };
  125. };
  126.  
  127. if(count (primaryWeaponItems player) > 0) then
  128. {
  129. {
  130. _pItems = _pItems + [_x];
  131. } forEach (primaryWeaponItems player);
  132. };
  133.  
  134. if(count (handGunItems player) > 0) then
  135. {
  136. {
  137. _hItems = _hItems + [_x];
  138. } forEach (handGunItems player);
  139. };
  140.  
  141. {
  142. _name = (_x select 0);
  143. _val = (_x select 1);
  144. if (_val > 0) then {
  145. for "_i" from 1 to _val do {
  146. _yItems = _yItems + [_name];
  147. };
  148. };
  149. } forEach [
  150. ["life_inv_apple", life_inv_apple],
  151. ["life_inv_rabbit", life_inv_rabbit],
  152. ["life_inv_salema", life_inv_salema],
  153. ["life_inv_ornate", life_inv_ornate],
  154. ["life_inv_mackerel", life_inv_mackerel],
  155. ["life_inv_tuna", life_inv_tuna],
  156. ["life_inv_mullet", life_inv_mullet],
  157. ["life_inv_catshark", life_inv_catshark],
  158. ["life_inv_fishingpoles", life_inv_fishingpoles],
  159. ["life_inv_water", life_inv_water],
  160. ["life_inv_donuts", life_inv_donuts],
  161. ["life_inv_turtlesoup", life_inv_turtlesoup],
  162. ["life_inv_coffee", life_inv_coffee],
  163. ["life_inv_fuelF", life_inv_fuelF],
  164. ["life_inv_fuelE", life_inv_fuelE],
  165. ["life_inv_pickaxe", life_inv_pickaxe],
  166. ["life_inv_tbacon", life_inv_tbacon],
  167. ["life_inv_lockpick", life_inv_lockpick],
  168. ["life_inv_redgull", life_inv_redgull],
  169. ["life_inv_peach", life_inv_peach],
  170. ["life_inv_spikeStrip", life_inv_spikeStrip],
  171. ["life_inv_defusekit", life_inv_defusekit],
  172. ["life_inv_storagesmall", life_inv_storagesmall],
  173. ["life_inv_handcuffs", life_inv_handcuffs],
  174. ["life_inv_handcuffkeys", life_inv_handcuffkeys],
  175. ["life_inv_storagebig", life_inv_storagebig]
  176. ];
  177.  
  178. _return pushBack _uItems;
  179. _return pushBack _uMags;
  180. _return pushBack _bItems;
  181. _return pushBack _bMags;
  182. _return pushBack _vItems;
  183. _return pushBack _vMags;
  184. _return pushBack _pItems;
  185. _return pushBack _hItems;
  186. if(call life_save_yinv) then {
  187. _return pushBack _yItems;
  188. } else {
  189. _return pushBack [];
  190. };
  191.  
  192. life_gear = _return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement