Advertisement
MasterFloat

Untitled

Sep 11th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. runtour: function(arg, user, room) {
  2. if(!user.hasRank(room, '+')) return false;
  3. if (Number(arg) > 15) return this.say(room, '__You can\'t make a tournament start in more then 15 minutes.__');
  4.  
  5. if (!arg) {
  6. this.timeStart = clearTimeout(this.timeStart);
  7. this.timeRemind = clearTimeout(this.timeRemind);
  8. this.timeAutodq = clearTimeout(this.timeAutodq);
  9. this.timeRunautodq = clearTimeout(this.timeRunautodq);
  10. this.timeWall = clearTimeout(this.timeWall);
  11.  
  12. this.say(room, '/tour start');
  13. this.say(room, '/tour autodq 2');
  14. this.say(room, '/tour runautodq');
  15. this.say(room, '/wall Good luck and Have fun!');
  16.  
  17. this.remind2 = setTimeout(function (room, remind2) {
  18. this.say(room, remind2);
  19. }.bind(this), 120 * 1000, room, '/tour remind');
  20. }
  21. if (arg) {
  22. if (arg === 'off') {
  23. if (!this.timeStart) return this.say(room, 'No tour autostart was set.');
  24. this.timeStart = clearTimeout(this.timeStart);
  25. this.timeRemind = clearTimeout(this.timeRemind);
  26. this.timeAutodq = clearTimeout(this.timeAutodq);
  27. this.timeRunautodq = clearTimeout(this.timeRunautodq);
  28. this.timeWall = clearTimeout(this.timeWall);
  29. return this.say(room, 'The tournament\'s autostart was canceled.');
  30. }
  31. if (!/(1|2|3|4|5|6|7|8|9|0)/i.test(arg)) return this.say(room, "Usage: ``-runtour`` it will start, activate the timer and remind the user of the on-going tournament. ``-runtour [minutes]`` Same but after a set amount of time. ``-runtour off`` cancels the ``-runtour [minutes] that you\'ve set if you\'ve set any. (**Must be Voice**)");
  32. this.say(room, 'The tournament will be starting in **' + arg + ' minute(s)**!');
  33.  
  34. this.timeStart = setTimeout(function (room, timeStart) {
  35. this.say(room, timeStart);
  36. }.bind(this), Number(arg) * 60000, room, '/tour start');
  37.  
  38. this.timeAutodq = setTimeout(function (room, timeAutodq) {
  39. this.say(room, timeAutodq);
  40. }.bind(this), Number(arg) * 60000 + 1000, room, '/tour autodq 2');
  41.  
  42. this.timeRunautodq = setTimeout(function (room, timeRunautodq) {
  43. this.say(room, timeRunautodq);
  44. }.bind(this), Number(arg) * 60000 + 1500, room, '/tour runautodq');
  45.  
  46. this.timeWall = setTimeout(function (room, timeWall) {
  47. this.say(room, timeWall);
  48. }.bind(this), Number(arg) * 60000 + 2000, room, '/wall Good luck and Have fun!');
  49.  
  50. }
  51.  
  52. var TheDate = new Date();
  53. logData.Data.log.push('Username: ' + user.name + '. Room: ' + room.id + '. Command: -runtour ' + arg + '. Time[' + TheDate + '].');
  54. fs.writeFileSync('./log.ini', ini.stringify(logData));
  55. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement