AimBot 0.2

aimbot will only work if you have a character rotation database; without it, it will not work

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name          AimBot 0.2
// @namespace     Tampermonkey
// @match         *://cavegame.io/*
// @grant         unsafeWindow
// @version       0.2
// @author        MihaLAS
// @description   aimbot will only work if you have a character rotation database; without it, it will not work
// @run-at        document-start
// @license       MIT
// ==/UserScript==

(function() {
    'use strict';
    const win = unsafeWindow || window;
    let myPos = { x: 0, y: 0 }, enemies = [], isAimActive = false;
    let currentAimAngle = 0, aimSpeed = 500;

    const rotationDatabase = {};

    const isTyping = () => {
        const el = document.activeElement;
        return el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA');
    };

    const OriginalWS = win.WebSocket;
    win.WebSocket = function(url, protocols) {
        const socket = new OriginalWS(url, protocols);
        const originalSend = socket.send;

        socket.send = function(data) {
            if (!data) return originalSend.apply(this, arguments);
            const bytes = new Uint8Array(data instanceof ArrayBuffer ? data : (data.buffer || data));

            if (bytes[0] === 34 && isAimActive) {
                const target = getNearest();
                if (target) {
                    const dx = target.x - myPos.x;
                    const dy = target.y - myPos.y;
                    let targetAngle = (Math.round(Math.atan2(dy, dx) * (180 / Math.PI)) + 360) % 360;

                    currentAimAngle = targetAngle;
                    const roundedAngle = Math.round(currentAimAngle);
                    const packet = rotationDatabase[roundedAngle] || rotationDatabase[String(roundedAngle)];

                    if (packet) {
                        originalSend.call(this, new Uint8Array(packet).buffer);
                        return;
                    }
                }
            }
            return originalSend.apply(this, arguments);
        };

        socket.addEventListener('message', async (e) => {
            const buffer = e.data instanceof Blob ? await e.data.arrayBuffer() : e.data;
            if (buffer instanceof ArrayBuffer) {
                const bytes = new Uint8Array(buffer), view = new DataView(buffer);
                let found = [];
                for (let i = 0; i < bytes.length - 15; i++) {
                    if (bytes[i] === 6 && bytes[i+1] === 112 && bytes[i+2] === 108) {
                        found.push({ x: view.getFloat32(i+7, false), y: view.getFloat32(i+11, false) });
                    }
                    if (bytes[i] === 6 && bytes[i+1] === 99 && bytes[i+2] === 97) {
                        let off = (bytes[i+7] === 6) ? 14 : 7;
                        myPos.x = view.getFloat32(i + off, false);
                        myPos.y = view.getFloat32(i + off + 4, false);
                    }
                }
                if (found.length > 0) enemies = found;
            }
        });
        return socket;
    };

    function getNearest() {
        return enemies
            .filter(e => Math.hypot(e.x - myPos.x, e.y - myPos.y) > 2)
            .sort((a, b) => Math.hypot(a.x - myPos.x, a.y - myPos.y) - Math.hypot(b.x - myPos.x, b.y - myPos.y))[0];
    }

    window.addEventListener('keydown', (e) => {
        if (isTyping()) return;
        if (e.code === 'KeyB') isAimActive = !isAimActive;
    });

    const createUI = () => {
        if (document.getElementById('aim-ui')) return;
        if (!document.body) {
            setTimeout(createUI, 100);
            return;
        }

        const ui = document.createElement('div');
        ui.id = 'aim-ui';
        Object.assign(ui.style, {
            position: 'fixed',
            bottom: '20px',
            right: '20px',
            padding: '8px 12px',
            background: 'rgba(0,0,0,0.8)',
            color: '#fff',
            fontSize: '14px',
            fontWeight: 'bold',
            fontFamily: 'monospace',
            zIndex: '100000',
            borderRadius: '4px',
            border: '1px solid #333',
            pointerEvents: 'none'
        });
        document.body.appendChild(ui);

        setInterval(() => {
            ui.innerHTML = `AIMBOT: <span style="color: ${isAimActive ? '#0f0' : '#f00'}">${isAimActive ? 'ON' : 'OFF'}</span> <small style="font-weight:normal; font-size:10px; opacity:0.6">[B]</small>`;
        }, 100);
    };

    createUI();
})();