Greasy Fork

Cryzen.io Auto BH

Auto bh in cryzen.io

当前为 2025-05-26 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/537334/1596258/Cryzenio%20Auto%20BH.js

// ==UserScript==
// @name         Cryzen.io Auto BH
// @namespace    ViolentMonkey
// @version      1.2
// @description  Auto bh in cryzen.io
// @author       Diwi
// @match        *://cryzen.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // === Wypisz w konsoli ===
    console.log('%cSuccess: Injected', 'color: lime; font-weight: bold;');

    // === Dodaj napis "Injected" w rogu ===
    const injectedDiv = document.createElement('div');
    injectedDiv.textContent = 'Injected';
    Object.assign(injectedDiv.style, {
        position: 'fixed',
        top: '10px',
        right: '10px',
        background: 'rgba(0,0,0,0.6)',
        color: 'lime',
        padding: '4px 10px',
        fontFamily: 'monospace',
        fontSize: '14px',
        borderRadius: '6px',
        zIndex: 9999
    });
    document.body.appendChild(injectedDiv);

    // === BHop toggle ===
    let bhopEnabled = false;

    document.addEventListener('keydown', (e) => {
        if (e.code === 'ShiftRight') {
            bhopEnabled = !bhopEnabled;
            injectedDiv.textContent = `Injected [BH: ${bhopEnabled ? 'ON' : 'OFF'}]`;
            console.log(`%cBHop ${bhopEnabled ? 'enabled' : 'disabled'}`, 'color: cyan; font-weight: bold;');
        }
    });

    // === Auto Bunnyhop ===
    setInterval(() => {
        if (!bhopEnabled) return;

        const gameCanvas = document.querySelector("canvas");
        if (!gameCanvas) return;

        const isFocused = document.activeElement === gameCanvas;
        if (!isFocused) return;

        // Wysyłamy event keydown i keyup dla spacji
        const downEvent = new KeyboardEvent("keydown", {
            key: " ",
            code: "Space",
            keyCode: 32,
            which: 32,
            bubbles: true
        });
        document.dispatchEvent(downEvent);

        const upEvent = new KeyboardEvent("keyup", {
            key: " ",
            code: "Space",
            keyCode: 32,
            which: 32,
            bubbles: true
        });
        setTimeout(() => {
            document.dispatchEvent(upEvent);
        }, 10);
    }, 50);
})();