Emote Selection Script with Toggle

A script where you can randomly spam emotes or you can choose one emote to spam constantly .

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Emote Selection Script with Toggle
// @namespace    Emote
// @version      1.1.0
// @description  A script where you can randomly spam emotes or you can choose one emote to spam constantly .
// @author       Vernice
// @match        https://evoworld.io/*
// @match        https://flyordie.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=evoworld.io
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // ⚠️ USE AT YOUR OWN RISK - Risk of ban
    let selectedEmoteId = 1; // Default emote
    function waitForServer() {
        if (typeof game !== 'undefined' && game.canvas) {
            initEmoteSpamToggleKey();
        } else {
            setTimeout(waitForServer, 500);
        }
    }

    function initEmoteSpamToggleKey() {
        let emoteSpamEnabled = false;
        let emoteSpamInterval;

        function startEmoteSpam() {
            emoteSpamInterval = setInterval(() => {
                if (typeof gameServer !== 'undefined' && !imDead && joinedGame) {
                    sendEmote(selectedEmoteId);
                }
            }, 1000);
        }

        function stopEmoteSpam() {
            clearInterval(emoteSpamInterval);
        }

        function setSelectedEmote(emoteId) {
            selectedEmoteId = emoteId;
            console.log(`Selected Emote ID: ${selectedEmoteId}`);
        }

        document.addEventListener('keydown', (e) => {
            if (e.key.toLowerCase() === 'p') {
                emoteSpamEnabled = !emoteSpamEnabled;
                if (emoteSpamEnabled) {
                    startEmoteSpam();
                    console.log("Emote spam: ON");
                } else {
                    stopEmoteSpam();
                    console.log("Emote spam: OFF");
                }
            }
            // Set selected emote by number keys 1-9
            if (e.key >= '1' && e.key <= '9') {
                setSelectedEmote(parseInt(e.key));
            }
        });
    }

    waitForServer();
})();