Space AutoFire

Turn spacebar into AutoFire toggle (E)

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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