LeventHAN

fn_loadGear.sqf

Sep 25th, 2018
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 4.50 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2.  
  3. private ["_itemArray","_handle"];
  4. _itemArray = life_gear;
  5. waitUntil {!(isNull (findDisplay 46))};
  6.  
  7. _handle = [] spawn life_fnc_stripDownPlayer;
  8. waitUntil {scriptDone _handle};
  9.  
  10. if (count _itemArray isEqualTo 0) exitWith {
  11.     switch (playerSide) do {
  12.         case west: {
  13.             [] call life_fnc_copLoadout;
  14.         };
  15.  
  16.         case civilian: {
  17.             [] call life_fnc_civLoadout;
  18.         };
  19.  
  20.         case independent: {
  21.             [] call life_fnc_medicLoadout;
  22.         };
  23.     };
  24. };
  25.  
  26. _itemArray params [
  27.     "_uniform",
  28.     "_vest",
  29.     "_backpack",
  30.     "_goggles",
  31.     "_headgear",
  32.     ["_items",[]],
  33.     "_prim",
  34.     "_seco",
  35.     ["_uItems",[]],
  36.     ["_uMags",[]],
  37.     ["_bItems",[]],
  38.     ["_bMags",[]],
  39.     ["_vItems",[]],
  40.     ["_vMags",[]],
  41.     ["_pItems",[]],
  42.     ["_hItems",[]],
  43.     ["_yItems",[]]
  44. ];
  45.  
  46. if (!(_goggles isEqualTo "")) then {_handle = [_goggles,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  47. if (!(_headgear isEqualTo "")) then {_handle = [_headgear,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  48. if (!(_uniform isEqualTo "")) then {_handle = [_uniform,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  49. if (!(_vest isEqualTo "")) then {_handle = [_vest,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  50. if (!(_backpack isEqualTo "")) then {_handle = [_backpack,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  51.  
  52. if (!isNil {(_this select 0)}) then {
  53.     life_maxWeight = life_maxWeight + (round(FETCH_CONFIG2(getNumber,"CfgVehicles",(backpack player),"maximumload") / 4));
  54. };
  55.  
  56. {_handle = [_x,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};} forEach _items;
  57.  
  58. {player addItemToUniform _x;} forEach (_uItems);
  59. {(uniformContainer player) addItemCargoGlobal [_x,1];} forEach (_uMags);
  60. {player addItemToVest _x;} forEach (_vItems);
  61. {(vestContainer player) addItemCargoGlobal [_x,1];} forEach (_vMags);
  62. {player addItemToBackpack _x;} forEach (_bItems);
  63. {(backpackContainer player) addItemCargoGlobal [_x,1];} forEach (_bMags);
  64. life_maxWeight = 100;
  65.  
  66. {
  67.     [true,(_x select 0),(_x select 1)] call life_fnc_handleInv;
  68. } forEach (_yItems);
  69.  
  70. [] spawn
  71. {
  72. while{true} do
  73. {
  74. waitUntil {!(backpack player isEqualTo “”)};
  75. _backpack = backpack player;
  76. _cfg = FETCH_CONFIG2(getNumber,“CfgVehicles”,_backpack,“maximumload”);
  77. _load = round(_cfg / 4);
  78.         if (backpack player isEqualTo "B_AssaultPack_khk") then { _load = 30; };            
  79.         if (backpack player isEqualTo "B_AssaultPack_Kerry") then { _load = 30; };
  80.         if (backpack player isEqualTo "B_AssaultPack_blk") then { _load = 30; };
  81.         if (backpack player isEqualTo "B_AssaultPack_cbr") then { _load = 30; };            
  82.         if (backpack player isEqualTo "B_AssaultPack_sgg") then { _load = 30; };
  83.         if (backpack player isEqualTo "B_Bergen_blk") then { _load = 50; };
  84.         if (backpack player isEqualTo "B_TacticalPack_oli") then { _load = 50; };
  85.         if (backpack player isEqualTo "B_Bergen_sgg") then { _load = 50; };
  86.         if (backpack player isEqualTo "B_Bergen_rgr") then { _load = 50; };            
  87.         if (backpack player isEqualTo "B_AssaultPack_mcamo_AT") then { _load = 70; };
  88.         if (backpack player isEqualTo "B_Kitbag_cbr") then { _load = 70; };
  89.         if (backpack player isEqualTo "B_Kitbag_sgg") then { _load = 70; };            
  90.         if (backpack player isEqualTo "B_Carryall_khk") then { _load = 80; };
  91.         if (backpack player isEqualTo "B_Carryall_oli") then { _load = 80; };            
  92.         if (backpack player isEqualTo "B_Carryall_cbr") then { _load = 80; };
  93.     life_maxWeight = life_minWeight + _load;
  94.     waitUntil {!(backpack player isEqualTo _backpack)};
  95.     if(backpack player isEqualTo "") then {
  96.         life_maxWeight = life_minWeight;
  97.     };
  98.     };
  99. };
  100. if (!(_prim isEqualTo "")) then {_handle = [_prim,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  101. if (!(_seco isEqualTo "")) then {_handle = [_seco,true,false,false,false] spawn life_fnc_handleItem; waitUntil {scriptDone _handle};};
  102.  
  103. {
  104.     if (!(_x isEqualTo "")) then {
  105.         player addPrimaryWeaponItem _x;
  106.     };
  107. } forEach (_pItems);
  108. {
  109.     if (!(_x isEqualTo "")) then {
  110.         player addHandgunItem _x;
  111.     };
  112. } forEach (_hItems);
  113.  
  114. [] call life_fnc_playerSkins;
Advertisement