Gats.io - Multiboxing Script

Multiboxing script for Gats.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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);
            };
        };
    }
 
})();