Space AutoFire

Turn spacebar into AutoFire toggle (E)

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

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.

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

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

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

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