Guest User

Untitled

a guest
Nov 8th, 2018
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. /**
  2. * @filename GameKeeper.js
  3. * @author Guild Privilege @ JSP
  4. * @desc An ingame muling assistant. Stays ingame for a preset time, will respond with time left, and will quit on command.
  5. */
  6.  
  7. function GameKeeper () {
  8. var time1 = 0, packet = 0;
  9.  
  10. this.chatEvent = function (name, msg) {
  11.  
  12. if( me.name == name )
  13. return; // dont respond to myself
  14.  
  15. switch ( msg ) {
  16. case "time": //1000 = 1sec
  17. var left = (time1*1000); //600000 = 10 minutes
  18. var timer = (600000-left); //
  19. var time2 = (timer/1000); //
  20. var time3 = ((time2/60).toFixed(2));
  21. var decTime = time3 % 1; // cut off anthing before the decimal
  22. var intTime = time3 - decTime; //Math.floor(time3); //return the largest int, chop off the decimal
  23. decTime = Math.floor(decTime * 60);
  24. // will be the number of seconds left
  25.  
  26. say("You have: " + intTime + " minutes and " + decTime + " seconds remaining.");
  27. break;//
  28. case "quit":
  29. //
  30. D2Bot.restart(); //
  31. break; //
  32. case "help": //
  33. say("The two commands are time & quit. Powered by Team Privilege.");
  34. break;//
  35. }
  36. };
  37.  
  38. addEventListener("chatmsg", this.chatEvent);
  39.  
  40. while (true) {
  41. //print("time1234: " + time1);
  42.  
  43.  
  44. if (time1 >= 600){
  45. D2Bot.restart();
  46. }
  47. if (packet >= 120){
  48. var packet = 0;
  49. sendPacket(1, 0x40);
  50. }
  51. print(packet);
  52.  
  53.  
  54. delay(1000);
  55. time1++;
  56. packet++;
  57.  
  58. }
  59. return true;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment