Shellshock.IO Aimbot & ESP Enhanced Plus

Adds advanced aimbot, ESP features, spin bot, and teammate exclusion for Shellshock.IO.

// ==UserScript==
// @name         Shellshock.IO Aimbot & ESP Enhanced Plus
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Adds advanced aimbot, ESP features, spin bot, and teammate exclusion for Shellshock.IO.
// @author       Cody
// @match        *://shellshock.io/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    // Settings and key bindings
    const settings = {
        aimbotEnabled: true,
        softAim: true,
        spinBotEnabled: false,
        espEnabled: true,
        showLines: true,
        autoAimTrigger: true,
        aimbotOnRightMouse: true,
    };

    const keyBindings = {
        KeyB: 'aimbotEnabled',
        KeyV: 'espEnabled',
        KeyN: 'showLines',
        KeyM: 'softAim',
        KeyK: 'spinBotEnabled',
        KeyJ: 'autoAimTrigger',
    };

    const keys = {};
    let spinAngle = 0;

    // Debounce toggles to avoid rapid key presses
    let debounce = false;
    document.addEventListener('keyup', (e) => {
        if (debounce || !keyBindings[e.code]) return;
        debounce = true;
        setTimeout(() => debounce = false, 200);

        const setting = keyBindings[e.code];
        settings[setting] = !settings[setting];
        console.log(`%c[Script]: ${setting} toggled: ${settings[setting]}`, 'color: green; font-weight: bold;');
        audioFeedback();
    });

    // Audio feedback for toggles
    function audioFeedback() {
        const audio = new Audio('https://www.soundjay.com/button/beep-07.wav');
        audio.volume = 0.3;
        audio.play();
    }

    // ESP and Aimbot logic
    let initialized = false;

    function initESP(scene) {
        if (initialized) return; // Avoid multiple initializations
        initialized = true;
        console.log('%c[Script]: ESP Initialized.', 'color: blue; font-weight: bold;');
    }

    function updateESP(players, myPlayer) {
        if (!settings.espEnabled) return;

        players.forEach(player => {
            if (player && player !== myPlayer) {
                if (!player.sphere) {
                    const material = new BABYLON.StandardMaterial('material', myPlayer.scene);
                    material.diffuseColor = new BABYLON.Color3(1, 0, 0); // Red color for enemy
                    player.sphere = BABYLON.MeshBuilder.CreateSphere('sphere', {}, myPlayer.scene);
                    player.sphere.material = material;
                }
                player.sphere.position.copyFrom(player.position);
            }
        });
    }

    function aimbot(players, myPlayer) {
        if (!settings.aimbotEnabled) return;
        let nearestPlayer = null;
        let minDistance = Infinity;

        players.forEach(player => {
            if (player && player !== myPlayer && player.team !== myPlayer.team) {
                const distance = BABYLON.Vector3.Distance(myPlayer.position, player.position);
                if (distance < minDistance) {
                    minDistance = distance;
                    nearestPlayer = player;
                }
            }
        });

        if (nearestPlayer) {
            const targetDelta = nearestPlayer.position.subtract(myPlayer.position);
            const targetYaw = Math.atan2(targetDelta.x, targetDelta.z);
            const targetPitch = -Math.atan2(targetDelta.y, targetDelta.length());

            const smoothFactor = settings.softAim ? 0.1 : 1; // Soft aim smoothness
            myPlayer.rotation.y += (targetYaw - myPlayer.rotation.y) * smoothFactor;
            myPlayer.rotation.x += (targetPitch - myPlayer.rotation.x) * smoothFactor;
        }
    }

    function spinBot(myPlayer) {
        if (!settings.spinBotEnabled) return;
        spinAngle += 0.2;
        myPlayer.rotation.y = spinAngle;
    }

    // Auto trigger for aimbot (fires when target in view)
    function autoAimTrigger(myPlayer, nearestEnemy) {
        if (!settings.autoAimTrigger || !nearestEnemy) return;
        if (settings.aimbotEnabled) {
            const distance = BABYLON.Vector3.Distance(myPlayer.position, nearestEnemy.position);
            if (distance < 30) { // Adjust distance threshold
                console.log('%c[Script]: Auto-aim firing!', 'color: red; font-weight: bold;');
                // Simulate left mouse click
                document.dispatchEvent(new MouseEvent('mousedown', { button: 0 }));
                setTimeout(() => document.dispatchEvent(new MouseEvent('mouseup', { button: 0 })), 100);
            }
        }
    }

    window.addEventListener('DOMContentLoaded', () => {
        console.log('%c[Script]: Script Loaded. Waiting for game...', 'color: orange; font-weight: bold;');

        const interval = setInterval(() => {
            if (window.gameInstance) {
                const { players, myPlayer } = window.gameInstance;

                initESP(myPlayer.scene);

                setInterval(() => {
                    if (myPlayer && players) {
                        updateESP(players, myPlayer);
                        aimbot(players, myPlayer);
                        spinBot(myPlayer);

                        const nearestEnemy = players.find(
                            player => player && player !== myPlayer && player.team !== myPlayer.team
                        );
                        autoAimTrigger(myPlayer, nearestEnemy);
                    }
                }, 16); // Run at ~60 FPS
                clearInterval(interval);
            }
        }, 1000);
    });

    // Debugging: Toggle debugging mode
    document.addEventListener('keydown', (e) => {
        if (e.code === 'KeyL') {
            settings.debugMode = !settings.debugMode;
            console.log(`%c[Script]: Debug mode: ${settings.debugMode}`, 'color: purple; font-weight: bold;');
        }
    });
})();