Advertisement
Guest User

Untitled

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