Advertisement
Terrah

betatimer cached

Apr 22nd, 2015
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. --Script is dead
  2.  
  3. local next = 0;
  4. local last = "";
  5.  
  6. local function Save(invited,next)
  7.  
  8.     local tbl = {};
  9.     tbl.name = invited;
  10.     tbl.next = next;
  11.  
  12.     MOD.SetVar("betatimer",JSONEncode(tbl));
  13. end
  14.  
  15. local function CheckAndGet()
  16.  
  17.     MOD.Timer("betatimer",1,CheckAndGet);
  18.  
  19.     local t = os.time();
  20.  
  21.     if t > next then
  22.  
  23.         local raw = MOD.GetVar("betatimer","#pathofexile");
  24.        
  25.         if raw~=nil then
  26.  
  27.             local data = JSONDecode(raw);
  28.            
  29.             if data.next > next then
  30.            
  31.                 last = data.name;
  32.                 next = data.next;
  33.                
  34.                 print(last.." has been invited to the closed beta!");
  35.             end
  36.         else
  37.             next = t+30;
  38.         end
  39.     end
  40. end
  41.  
  42. --[[MOD.Timer("betatimer",1,CheckAndGet);
  43.  
  44. return function(msg,usr,chan)
  45.  
  46.     if last==nil or last=="" then
  47.         return;
  48.     end
  49.  
  50.     local coming = next-os.time();
  51.  
  52.     if coming <= 0 then
  53.         coming = "Any moment now!";
  54.     else
  55.         coming = MOD.SecondToSpan(coming);
  56.     end
  57.  
  58.     print("Last invite: "..last.." next invite: " .. coming);
  59. end]]
  60.  
  61. return nil;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement