Advertisement
hadar

Untitled

Apr 9th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. This script checks differences in times
  2. =============================================================
  3. local timeDiff = function(t2,t1)
  4. local d1,d2,carry,diff = os.date('*t',t1),os.date('*t',t2),false,{}
  5. local colMax = {60,60,24,os.date('*t',os.time{year=d1.year,month=d1.month+1,day=0}).day,12}
  6. d2.hour = d2.hour - (d2.isdst and 1 or 0) + (d1.isdst and 1 or 0)
  7. for i,v in ipairs({'sec','min','hour','day','month','year'}) do
  8. diff[v] = d2[v] - d1[v] + (carry and -1 or 0)
  9. carry = diff[v] < 0
  10. if carry then diff[v] = diff[v] + colMax[i] end
  11. end
  12. return diff
  13. end
  14.  
  15. local td=timeDiff(os.time(),os.time{year=zs.param(2),month=zs.param(3),day=zs.param(4),hour=zs.param(5),min=zs.param(6),sec=zs.param(7)})
  16.  
  17. local name = zs.param(1)
  18. for i,v in pairs(td) do zs.cmd.addkey(name,i,v) end
  19.  
  20. This is the script i call when its quest time
  21. =============================================================
  22. zs.getclass("q_trigs").enabled = 1
  23. send("gt @C+@B=@C+(@CQ@Buest @CT@Bime@C)@C+@B=@C+")
  24. image=math.random(1,23)
  25. --zs.mxp("<image ./Images/questpic" .. image .. ".jpg>")
  26. zs.cmd.play("Quest.mp3")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement