Split Auto Clicker (Left = R, Right = T)

Auto clicks left mouse on R, right mouse on T (toggle keys)

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Split Auto Clicker (Left = R, Right = T)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Auto clicks left mouse on R, right mouse on T (toggle keys)
// @author       ROcker_Cats_YT
// @match        *://bloxd.io/*
// @grant        none
// @license      MIT
// ==/UserScript==


(function () {
    'use strict';

    const CPS = 10; // clicks per second
    const interval = 1000 / CPS;

    let leftClicking = false;
    let rightClicking = false;
    let lastClickTime = 0;
    let targetCanvas = null;

    function getCanvas() {
        if (!targetCanvas || !document.contains(targetCanvas)) {
            targetCanvas = document.querySelector('canvas');
        }
        return targetCanvas;
    }

    function clickCanvas(button = 0) {
        const canvas = getCanvas();
        if (!canvas) return;

        const rect = canvas.getBoundingClientRect();
        const clientX = rect.left + rect.width / 2;
        const clientY = rect.top + rect.height / 2;

        ["mousedown", "mouseup", "click"].forEach(type => {
            const event = new MouseEvent(type, {
                bubbles: true,
                cancelable: true,
                view: window,
                clientX,
                clientY,
                button
            });
            canvas.dispatchEvent(event);
        });
    }

    function loop(timestamp) {
        if (timestamp - lastClickTime >= interval) {
            if (leftClicking) clickCanvas(0); // Left click
            if (rightClicking) clickCanvas(2); // Right click
            lastClickTime = timestamp;
        }
        requestAnimationFrame(loop);
    }

    document.addEventListener("keydown", e => {
        if (e.key.toLowerCase() === "r") {
            leftClicking = !leftClicking;
            console.log(`[AutoClicker] Left clicks: ${leftClicking ? "ON" : "OFF"}`);
        }
        if (e.key.toLowerCase() === "t") {
            rightClicking = !rightClicking;
            console.log(`[AutoClicker] Right clicks: ${rightClicking ? "ON" : "OFF"}`);
        }
    });

    requestAnimationFrame(loop);
})();