aeroson

Untitled

Apr 28th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. /*
  2.  
  3. AUTHOR: aeroson
  4.  
  5. */
  6.  
  7. if (isServer) then {
  8. private ["_box","_pos"];
  9. _box = _this select 0;
  10. _pos = getPosATL _box;
  11. _box setPos [_pos select 0, _pos select 1, -10];
  12. sleep 2;
  13. };
  14.  
  15. if (isDedicated) exitWith {};
  16.  
  17.  
  18. private ["_box","_boxn","_pos","_dir","_up","_contentNames","_resupplyTime","_add","_contentCount","_contentData","_setBox","_createBox"];
  19.  
  20. _box = _this select 0;
  21. _contentNames = _this select 1;
  22. _contentCount = if(count _this > 2) then { _this select 2; } else { 1; };
  23. _resupplyTime = if(count _this > 3) then { _this select 3; } else { 300; };
  24.  
  25. _pos = getPosATL _box;
  26. _dir = vectorDir _box;
  27. _up = vectorUp _box;
  28.  
  29. hideObject _box;
  30. clearMagazineCargo _box;
  31. clearWeaponCargo _box;
  32. clearItemCargo _box;
  33. clearBackpackCargo _box;
  34. _box enableSimulation false;
  35.  
  36. _add = {
  37. private ["_cargo","_item","_count"];
  38. _cargo = _this select 0;
  39. _item = _this select 1;
  40. _count = _this select 2;
  41. if(isClass(configFile>>"CfgMagazines">>_item)) then {
  42. _cargo addMagazineCargo [_item,_count];
  43. } else {
  44. if(getNumber(configFile>>"CfgVehicles">>_item>>"isbackpack")==1) then {
  45. _cargo addBackpackCargo [_item,_count];
  46. } else {
  47. if(isClass(configFile>>"CfgWeapons">>_item>>"WeaponSlotsInfo")&&getNumber(configFile>>"CfgWeapons">>_item>>"showempty")==1) then {
  48. //_cargo addWeaponCargo [_item,_count];
  49. } else {
  50. _cargo addItemCargo [_item,_count];
  51. };
  52. };
  53. };
  54. };
  55.  
  56.  
  57.  
  58. /*
  59. magazines
  60. count =>5
  61.  
  62. underbarrel
  63. type 16
  64. count <5
  65.  
  66. explosives
  67. type 512
  68. count <5
  69.  
  70. throwables
  71. type 256
  72. count <5
  73. */
  74.  
  75. // magazines, underbarrel, explosives, throwables, weapons, uniforms, vests, backpacks, attachments, items, headgear
  76. // [this,["magazines","weapons"] execVM 'crate_fncs\fnc_init_crate.sqf';
  77. _contentData = [];
  78. {
  79. _contentData set [count _contentData, [] call compile preprocessFileLineNumbers format["client\crate\get_%1.sqf",_x]];
  80. } forEach _contentNames;
  81.  
  82. _createBox = {
  83. _boxn = (typeof _box) createVehicleLocal [0,0, 10000000];
  84. _boxn addEventHandler ["HandleDamage",{}];
  85. _boxn setVelocity [0,0,0];
  86. _boxn setPosATL [_pos select 0, _pos select 1, .5];
  87. _boxn setVectorDirAndUp [_dir,_up];
  88. _boxn setDammage 0;
  89. player reveal _boxn;
  90. };
  91.  
  92. [] call _createBox;
  93.  
  94. while {true} do {
  95.  
  96. clearMagazineCargo _boxn;
  97. clearWeaponCargo _boxn;
  98. clearItemCargo _boxn;
  99. clearBackpackCargo _boxn;
  100.  
  101. {
  102. {
  103. [_boxn, _x, _contentCount] call _add;
  104. } foreach _x;
  105. } foreach _contentData;
  106.  
  107. if(_resupplyTime==0) exitWith {};
  108. sleep _resupplyTime;
  109.  
  110. if(!alive _boxn) then {
  111. [] call _createBox;
  112. };
  113.  
  114. };
Advertisement
Add Comment
Please, Sign In to add comment