Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. YRUNpurge = {
  2. if(!isNull(_this)) then {
  3. _this enableSimulation false;
  4. _this removeAllMPEventHandlers "mpkilled";
  5. _this removeAllMPEventHandlers "mphit";
  6. _this removeAllMPEventHandlers "mprespawn";
  7. _this removeAllEventHandlers "FiredNear";
  8. _this removeAllEventHandlers "HandleDamage";
  9. _this removeAllEventHandlers "Killed";
  10. _this removeAllEventHandlers "Fired";
  11. _this removeAllEventHandlers "GetOut";
  12. _this removeAllEventHandlers "GetIn";
  13. _this removeAllEventHandlers "Local";
  14. clearVehicleInit _this;
  15. deleteVehicle _this;
  16. deleteGroup (group _this);
  17. _this = nil;
  18. };
  19. };
  20.  
  21. : objectDelete = {
  22.  
  23. if (((damage _this)>0.99)&&!(_this isKindOf "MAN")&&!(_this isKindOf "CAAnimalBase")&&!(_this isKindOf "zZombie_Base")&&!(_this isKindOf "static")&&!(_this isKindOf "building")) then {
  24. _objectID = _this getVariable ['ObjectID','0'];
  25. _objectUID = _this getVariable ['ObjectUID','0'];
  26. if (isNil '_objectID') exitWith {};
  27. if (isNil '_objectUID') exitWith {};
  28.  
  29. [_objectID,_objectUID,player] call server_deleteObj;
  30.  
  31. if !(isNull _this) then {deleteVehicle _this};
  32. };
  33. };
  34.  
  35.  
  36.  
  37.  
  38. if (isServer) then {
  39. [] spawn {
  40. private["_lastbikeClean","_lastLootClean","_lastZombieClean","_lastGroupClean","_lastSeagullClean","_countCleaned","_countTotal","_lootPiles","_seagulls","_zombies","_nearby","_pos","_keep","_ammobox","_lastvehiclecleanup","_lastservercleancheck"];
  41. waitUntil {!(isNil "sm_done");};
  42. diag_log text "CLEANUP: Initialized...";
  43.  
  44. _lastZombieClean = diag_tickTime;
  45. _lastGroupClean = diag_tickTime;
  46. _lastSeagullClean = diag_tickTime;
  47. _lastvehiclecleanup = diag_tickTime;
  48. _lastservercleancheck = diag_tickTime;
  49. _lastbikeClean = diag_tickTime;
  50.  
  51. while {true} do {
  52.  
  53. if ((diag_tickTime - _lastbikeClean) > 120) then {
  54. _lastbikeClean = diag_tickTime;
  55. _bikes = entities 'MMT_Civ';
  56. _deleted = 0;
  57. {
  58. _obj = _x;
  59. if(!isNull _obj)then
  60. {
  61. _count = {isPlayer _x} count (_obj nearEntities 100);
  62. if(_count == 0)then
  63. {
  64. _deleted = _deleted + 1;deleteVehicle _obj;
  65. };
  66. };
  67. } forEach _bikes;
  68. };
  69.  
  70. if ((diag_tickTime - _lastZombieClean) > 120) then {
  71. _lastZombieClean = diag_tickTime;
  72. _zombies = entities "zZombie_Base";
  73. _countTotal = count _zombies;
  74. _countCleaned = 0;
  75. {
  76. if(!(isNull _x)) then {
  77. if (local _x) then {
  78. _x call YRUNpurge;
  79. _countCleaned = _countCleaned + 1;
  80. } else {
  81. if (!alive _x) then {
  82. _pos = getPosATL _x;
  83. if (count _pos > 0) then {
  84. _nearby = {(isPlayer _x) and (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
  85. if (_nearby==0) then {
  86. _x call YRUNpurge;
  87. _countCleaned = _countCleaned + 1;
  88. };
  89. };
  90. };
  91. };
  92. };
  93. sleep 0.001;
  94. } forEach _zombies;
  95. };
  96.  
  97. if (((diag_tickTime - _lastvehiclecleanup) > 120)) then
  98. {
  99. _lastvehiclecleanup = diag_tickTime;
  100. private ["_YRUNVC","_vehs","_garage"];
  101. _YRUNVC = 0;
  102. _vehs = [];
  103. {
  104. _garage = (getPosATL _x) nearObjects ["Land_sara_hasic_zbroj",7];
  105. if !((count _garage) > 1) then {
  106. if (((damage _x)>0.99)&&!(_x isKindOf "MAN")&&!(_x isKindOf "CAAnimalBase")&&!(_x isKindOf "zZombie_Base")&&!(_x isKindOf "static")&&!(_x isKindOf "building")) then {
  107. if (typeOf _x != "SHEEP") then {
  108. _x spawn objectDelete;
  109. _YRUNVC = _YRUNVC + 1;
  110. _vehs = _vehs + [typeOf _x];
  111. };
  112. };
  113. };
  114. } forEach (vehicles);
  115. };
  116.  
  117. if (((diag_tickTime - _lastservercleancheck) > 180)) then
  118. {
  119. _lastservercleancheck = diag_tickTime;
  120. private ["_itemclasses","_itemlist","_itemCount"];
  121. _itemclasses =
  122. [
  123. "GraveCrossHelmet_EP1","GraveCrossHelmet_DZ","wreck","crater","craterlong","PartWoodPile",
  124. "SeaGull","Rabbit","WildBoar","Cow","Goat","Sheep","Bird","wire_cat1",
  125. "CAAnimalBase","Sound_Flies"
  126. ];
  127. {
  128. _itemlist = allMissionObjects _x;
  129. _itemCount = (count _itemlist);
  130. {
  131. if ((typeOf _x != "DZ_fin")||(typeOf _x != "DZ_pastor")||(typeOf _x != "SHEEP")) then {
  132. _x spawn objectDelete;
  133. };
  134. } forEach (allMissionObjects _x);
  135. } forEach _itemclasses;
  136. };
  137.  
  138. if ((diag_tickTime - _lastGroupClean) > 120) then {
  139. _lastGroupClean = diag_tickTime;
  140. _countTotal = count allGroups;
  141. _countCleaned = 0;
  142. {
  143. if(!(isNull _x)) then {
  144. if (count units _x == 0) then {
  145. deleteGroup _x;
  146. _x = nil;
  147. _countCleaned = _countCleaned + 1;
  148. };
  149. };
  150. sleep 0.001;
  151. } forEach allGroups;
  152. };
  153.  
  154. if ((diag_tickTime - _lastSeagullClean) > 120) then {
  155. _lastSeagullClean = diag_tickTime;
  156. _seagulls = entities "Seagull";
  157. _countTotal = count _seagulls;
  158. _countCleaned = 0;
  159. {
  160. _x call YRUNpurge;
  161. _countCleaned = _countCleaned + 1;
  162. sleep 0.001;
  163. } forEach _seagulls;
  164. };
  165.  
  166. sleep 1;
  167. };
  168. };
  169. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement