test

Show

// ==UserScript==
// @name         test
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Show
// @author       Personal Use Only
// @match        test
// @grant        none
// @match        *://*.shellshock.io/*
// @grant        none
// @run-at       document-start
// @require      https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js
// @require     https://cdn.jsdelivr.net/npm/[email protected]/dist/tweakpane.min.js
// @require      https://cdn.jsdelivr.net/npm/@tweakpane/[email protected]/dist/tweakpane-plugin-essentials.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js
//
// @license MIT
// ==/UserScript==

/* jshint esversion: 7 */

(() => {
    'use strict';

    let espEnabled = false;

    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    canvas.style.position = 'fixed';
    canvas.style.top = '0';
    canvas.style.left = '0';
    canvas.style.pointerEvents = 'none';
    canvas.style.zIndex = '9999';
    document.body.appendChild(canvas);

    function resize() {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
    }

    window.addEventListener('resize', resize);
    resize();

    function worldToScreen(position, camera) {
        // Assuming game uses THREE.js
        if (!position || !camera) return null;
        const vector = new THREE.Vector3(position.x, position.y, position.z);
        vector.project(camera);
        return {
            x: (vector.x + 1) * canvas.width / 2,
            y: (-vector.y + 1) * canvas.height / 2
        };
    }

    function drawESP(player, myPlayer, camera) {
        if (!player || !player.position || !myPlayer || !camera) return;
        const screenPos = worldToScreen(player.position, camera);
        if (!screenPos) return;

        const dx = player.position.x - myPlayer.position.x;
        const dy = player.position.y - myPlayer.position.y;
        const dz = player.position.z - myPlayer.position.z;
        const distance = Math.sqrt(dx*dx + dy*dy + dz*dz).toFixed(1);

        ctx.fillStyle = 'rgba(255, 0, 0, 0.7)';
        ctx.font = '16px Arial';
        ctx.fillText(`Enemy: ${distance}m`, screenPos.x, screenPos.y - 10);

        ctx.beginPath();
        ctx.arc(screenPos.x, screenPos.y, 8, 0, 2 * Math.PI);
        ctx.strokeStyle = 'red';
        ctx.lineWidth = 2;
        ctx.stroke();
    }

    function autoReload(myPlayer) {
        if (myPlayer && myPlayer.weapon && myPlayer.weapon.ammo === 0) {
            const e = new KeyboardEvent('keydown', {key: 'r', code: 'KeyR', bubbles: true, cancelable: true});
            document.dispatchEvent(e);
        }
    }

    window.addEventListener('keydown', (event) => {
        if (event.code === 'PageUp') {
            espEnabled = !espEnabled;
        }
    });

    function gameLoop() {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        const players = window.players || [];
        const myPlayer = window.myPlayer;
        const camera = window.camera; // you may need to get actual camera object from the game

        if (espEnabled && players.length > 0 && myPlayer && camera) {
            players.forEach(p => {
                if (p.team !== myPlayer.team && p.hp > 0) {
                    drawESP(p, myPlayer, camera);
                }
            });
        }

        autoReload(myPlayer);

        requestAnimationFrame(gameLoop);
    }

    requestAnimationFrame(gameLoop);

})();