Space AutoFire

Turn spacebar into AutoFire toggle (E)

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         Space AutoFire
// @namespace    https://greatest.deepsurf.us/en/users/467236-diepiodiscord
// @version      1
// @description  Turn spacebar into AutoFire toggle (E)
// @author       diep.io#7444
// @match        https://diep.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var keyDown = document.createEvent("Events"); keyDown.initEvent("keydown", true, true); keyDown.keyCode = 69; // 69 is the keyCode for E
    var keyUp = document.createEvent("Events"); keyUp.initEvent("keyup", true, true); keyUp.keyCode = 69;

    document.addEventListener('keydown', function(event)
    {
        if (event.keyCode === 32) // spacebar
        {
            event.cancelBubble = true; // Prevent spacebar from firing when held down, we are changing it to a toggle
            if (event.repeat) return; // Disable holding down key to spam
            window.dispatchEvent(keyDown);
            window.dispatchEvent(keyUp);
        }
    });
})();