Auto Reload

Automatically reloads weapon and toggles on/off with C key, with visual indicator. Pauses on mouse click.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

// ==UserScript==
// @name         Auto Reload
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Automatically reloads weapon and toggles on/off with C key, with visual indicator. Pauses on mouse click.
// @author       blah_blah1.
// @match        *://*.battledudes.io/*
// @license      MIT
// @icon         https://sun9-74.userapi.com/impg/6jY26kEuZ0qU5I9x7mdBOdQ2zA8pG8H9s3AkDw/BTLz1oDKei0.jpg?size=604x340&quality=96&sign=9fe860f5ff054a01d1ffef1c2f9c79fb&type=album
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let autoReloadEnabled = false;
    let intervalId;
    let mousePressed = false;

    const indicator = document.createElement('div');
    indicator.style.position = 'fixed';
    indicator.style.top = '40px';
    indicator.style.right = '10px';
    indicator.style.padding = '10px';
    indicator.style.backgroundColor = 'rgba(51, 51, 51, 0.8)';
    indicator.style.color = 'white';
    indicator.style.border = '2px solid #666';
    indicator.style.borderRadius = '5px';
    indicator.style.zIndex = '1000';
    indicator.style.overflow = 'hidden';
    indicator.innerText = 'Auto Reload: OFF';
    document.body.appendChild(indicator);

    function updateIndicator() {
        if (autoReloadEnabled) {
            indicator.style.backgroundColor = 'rgba(51, 51, 51, 0.8)';
            indicator.innerText = 'Auto Reload: ON';
        } else {
            indicator.style.backgroundColor = 'rgba(51, 51, 51, 0.8)';
            indicator.innerText = 'Auto Reload: OFF';
        }
    }

    function autoReload() {
        const keyDownEvent = new KeyboardEvent('keydown', { key: 'R', code: 'KeyR', keyCode: 82, which: 82, bubbles: true });
        const keyUpEvent = new KeyboardEvent('keyup', { key: 'R', code: 'KeyR', keyCode: 82, which: 82, bubbles: true });

        document.dispatchEvent(keyDownEvent);
        setTimeout(() => {
            document.dispatchEvent(keyUpEvent);
        }, 0);
    }

    function startAutoReload() {
        intervalId = setInterval(() => {
            if (autoReloadEnabled && !mousePressed) {
                autoReload();
            }
        }, 0);
    }

    function stopAutoReload() {
        clearInterval(intervalId);
    }

    document.addEventListener('keydown', (event) => {
        if (event.key === 'c' || event.key === 'C') {
            autoReloadEnabled = !autoReloadEnabled;
            updateIndicator();
            if (autoReloadEnabled) {
                startAutoReload();
            } else {
                stopAutoReload();
            }
            console.log(`Auto Reload: ${autoReloadEnabled ? 'Enabled' : 'Disabled'}`);
        }
    });

    document.addEventListener('mousedown', () => {
        mousePressed = true;
    });

    document.addEventListener('mouseup', () => {
        mousePressed = false;
    });

    if (autoReloadEnabled) {
        startAutoReload();
    } else {
        stopAutoReload();
    }

})();