Gats.io - Multiboxing Script

Multiboxing script for Gats.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Gats.io - Multiboxing Script
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Multiboxing script for Gats.
// @author       nitrogem35
// @match        https://gats.io
// ==/UserScript==
 
(function() {
    'use strict';
    //note for the dev: fix your game lmfao
    var channel = new BroadcastChannel('multibox');
    var main = true;
 
    channel.postMessage('.');
 
    channel.onmessage = function(ev) {
        if(ev.data == '.') {
            main = false;
            document.addEventListener('mousemove', mousemove);
 
            function mousemove(event) {
                channel.postMessage(`m,${event.clientX},${event.clientY}`);
            }
 
            document.addEventListener('mousedown', mousedown);
 
            function mousedown(event) {
                channel.postMessage(`k,${event.clientX},${event.clientY},0`);
            }
 
            document.addEventListener('mouseup', mouseup);
 
            function mouseup(event) {
                channel.postMessage(`k,${event.clientX},${event.clientY},1`);
            }
 
            document.addEventListener('keydown', keydown);
 
            function keydown(event) {
                channel.postMessage(`a,${event.keyCode},1`);
            }
 
            document.addEventListener('keyup', keyup);
 
            function keyup(event) {
                channel.postMessage(`a,${event.keyCode},0`);
            }
        }
        else if(main) {
            if(ev.data.startsWith("m")) {
                var packet = ev.data.split(",");
                packet.shift();
                var mouseMoveEvent = document.createEvent("MouseEvents");
                mouseMoveEvent.initMouseEvent(
                    "mousemove",true,false,unsafeWindow,1,50,50,packet[0],packet[1],false,false,false,false,0,null
                );
                canvas.dispatchEvent(mouseMoveEvent);
            };
 
            if(ev.data.startsWith("k")) {
                var packet = ev.data.split(",")
                packet.shift();
                var mouseClickEvent = document.createEvent("MouseEvents");
                var z = ["mousedown", "mouseup"]
                var type = z[parseInt(packet[2])]
                mouseClickEvent.initMouseEvent(type,true,false,unsafeWindow,1,50,50,packet[0],packet[1],false,false,false,false,0,null);
                canvas.dispatchEvent(mouseClickEvent)
            };
 
            if(ev.data.startsWith("a")) {
                var packet = ev.data.split(",");
                packet.shift();
                if(packet[1] == "1") {
                    var evt = new KeyboardEvent('keydown', {'keyCode': packet[0]});
                }
                else {
                    var evt = new KeyboardEvent('keyup', {'keyCode': packet[0]});
                };
                document.dispatchEvent(evt);
            };
        };
    }
 
})();