Guest User

Untitled

a guest
Jan 15th, 2014
3,798
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     saveMonitor = [] spawn
  2.     {
  3.         //spawn a loop that runs every 120 seconds
  4.         while {true} do
  5.         {
  6.             diag_log format["Processing %1 saves for players...",count players];
  7.             //run this for every player on the server alive or dead
  8.             {
  9.                 _x call dbSavePlayerPrep;
  10.                 //for every living player on the server
  11.                 if (alive _x) then {
  12.                     _result = dbServerSaveCharacter _x;
  13.                     //get last saved player position
  14.                     _pos = _x getVariable ["p1",[0,0,0]];
  15.                     //if last save is 1000m away from current position
  16.                     if (_pos distance _x > 1000) then
  17.                     {
  18.                         //set position back to last save
  19.                         _x setPosATL _pos;
  20.                         //disable all controls and force game restart
  21.                         [owner _x] spawnForClient {disableUserInput true};
  22.                     };
  23.                 };
  24.                 //save current position
  25.                 _x setVariable ["p1",getPosATL _x];    
  26.             } forEach players; //every player on the server alive or dead
  27.             sleep 120; //wait 120seconds
  28.         };
  29.     };
RAW Paste Data