Advertisement
Guest User

afg

a guest
Sep 23rd, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. /*
  2. DayZ Mission System Timer by Vampire
  3. Based on fnc_hTime by TAW_Tonic and SMFinder by Craig
  4. This function is launched by the Init and runs continuously.
  5. */
  6. private["_run","_timeDiff","_timeVar","_wait","_cntMis","_ranMis","_varName"];
  7.  
  8. //Let's get our time Min and Max
  9. _timeDiff = DZMSMajorMax - DZMSMajorMin;
  10. _timeVar = _timeDiff + DZMSMajorMin;
  11.  
  12. diag_log text format ["[DZMS]: Major Mission Clock Starting!"];
  13.  
  14. //Lets get the loop going
  15. _run = true;
  16. while {_run} do
  17. {
  18. //Lets wait the random time
  19. _wait = round(random _timeVar);
  20. [_wait,5] call DZMSSleep;
  21.  
  22. //Let's check that there are missions in the array.
  23. //If there are none, lets end the timer.
  24. _cntMis = count DZMSMajorArray;
  25. if (_cntMis == 0) then { _run = false; };
  26.  
  27. //Lets pick a mission
  28. _ranMis = floor (random _cntMis);
  29. _varName = DZMSMajorArray select _ranMis;
  30.  
  31. // clean up all the existing units before starting a new one
  32. {if (alive _x) then {_x call DZMSPurgeObject;};} forEach DZMSUnitsMajor;
  33.  
  34. // rebuild the array for the next mission
  35. DZMSUnitsMajor = [];
  36.  
  37. //Let's Run the Mission
  38. [] execVM format ["\z\addons\dayz_server\DZMS\Missions\Major\%1.sqf",_varName];
  39. diag_log text format ["[DZMS]: Running Major Mission %1.",_varName];
  40.  
  41. //Let's wait for it to finish or timeout
  42. waitUntil {DZMSMajDone};
  43. DZMSMajDone = false;
  44. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement