Auto Respawn

Automatically clicks the respawn button with O key toggle. Green = ON, Red = OFF.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Auto Respawn
// @namespace    http://tampermonkey.net/
// @version      2.5
// @description  Automatically clicks the respawn button with O key toggle. Green = ON, Red = OFF.
// @author       M.Rithish
// @match        *://battledudes.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    let autoRespawnEnabled = false;

    // Toggle Display Box
    const toggle = document.createElement('div');
    toggle.style.position = 'fixed';
    toggle.style.top = '40px';
    toggle.style.left = '1100px';
    toggle.style.padding = '10px';
    toggle.style.fontSize = '16px';
    toggle.style.color = 'white';
    toggle.style.border = '2px solid #666';
    toggle.style.borderRadius = '5px';
    toggle.style.zIndex = '1000';
    toggle.style.overflow = 'hidden';
    toggle.style.fontFamily = 'monospace';
    toggle.style.backgroundColor = 'red'; // start with OFF
    toggle.innerText = 'Auto Respawn: OFF';
    document.body.appendChild(toggle);

    // Listen for 'O' key to toggle auto respawn
    document.addEventListener('keydown', function (e) {
        if (e.key.toUpperCase() === 'O') {
            autoRespawnEnabled = !autoRespawnEnabled;
            toggle.innerText = 'Auto Respawn: ' + (autoRespawnEnabled ? 'ON' : 'OFF');
            toggle.style.backgroundColor = autoRespawnEnabled ? 'green' : 'red';
        }
    });

    // Function for Auto Respawn
    setInterval(() => {
        if (!autoRespawnEnabled) return;
        const btn = document.querySelector('#respawn_button');
        if (btn && btn.offsetParent !== null) {
            btn.click();
        }
    }, 21);
})();