Greasy Fork is available in English.

Gats.io - Multiboxing Script

Multiboxing script for Gats.

  1. // ==UserScript==
  2. // @name Gats.io - Multiboxing Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Multiboxing script for Gats.
  6. // @author nitrogem35
  7. // @match https://gats.io
  8. // ==/UserScript==
  9. (function() {
  10. 'use strict';
  11. //note for the dev: fix your game lmfao
  12. var channel = new BroadcastChannel('multibox');
  13. var main = true;
  14. channel.postMessage('.');
  15. channel.onmessage = function(ev) {
  16. if(ev.data == '.') {
  17. main = false;
  18. document.addEventListener('mousemove', mousemove);
  19. function mousemove(event) {
  20. channel.postMessage(`m,${event.clientX},${event.clientY}`);
  21. }
  22. document.addEventListener('mousedown', mousedown);
  23. function mousedown(event) {
  24. channel.postMessage(`k,${event.clientX},${event.clientY},0`);
  25. }
  26. document.addEventListener('mouseup', mouseup);
  27. function mouseup(event) {
  28. channel.postMessage(`k,${event.clientX},${event.clientY},1`);
  29. }
  30. document.addEventListener('keydown', keydown);
  31. function keydown(event) {
  32. channel.postMessage(`a,${event.keyCode},1`);
  33. }
  34. document.addEventListener('keyup', keyup);
  35. function keyup(event) {
  36. channel.postMessage(`a,${event.keyCode},0`);
  37. }
  38. }
  39. else if(main) {
  40. if(ev.data.startsWith("m")) {
  41. var packet = ev.data.split(",");
  42. packet.shift();
  43. var mouseMoveEvent = document.createEvent("MouseEvents");
  44. mouseMoveEvent.initMouseEvent(
  45. "mousemove",true,false,unsafeWindow,1,50,50,packet[0],packet[1],false,false,false,false,0,null
  46. );
  47. canvas.dispatchEvent(mouseMoveEvent);
  48. };
  49. if(ev.data.startsWith("k")) {
  50. var packet = ev.data.split(",")
  51. packet.shift();
  52. var mouseClickEvent = document.createEvent("MouseEvents");
  53. var z = ["mousedown", "mouseup"]
  54. var type = z[parseInt(packet[2])]
  55. mouseClickEvent.initMouseEvent(type,true,false,unsafeWindow,1,50,50,packet[0],packet[1],false,false,false,false,0,null);
  56. canvas.dispatchEvent(mouseClickEvent)
  57. };
  58. if(ev.data.startsWith("a")) {
  59. var packet = ev.data.split(",");
  60. packet.shift();
  61. if(packet[1] == "1") {
  62. var evt = new KeyboardEvent('keydown', {'keyCode': packet[0]});
  63. }
  64. else {
  65. var evt = new KeyboardEvent('keyup', {'keyCode': packet[0]});
  66. };
  67. document.dispatchEvent(evt);
  68. };
  69. };
  70. }
  71. })();