ESP + triggerbot for smashkarts.io

Highlights player border + auto space when target is visible (raycasting)

目前為 2025-11-13 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         ESP + triggerbot for smashkarts.io
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Highlights player border + auto space when target is visible (raycasting)
// @license MIT
// @author       DogeSmashMonkey
// @match        *://smashkarts.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Popup
    function showPopup(message) {
        const popup = document.createElement('div');
        popup.style.position = 'fixed';
        popup.style.top = '0';
        popup.style.left = '0';
        popup.style.width = '100%';
        popup.style.backgroundColor = '#333';
        popup.style.color = '#fff';
        popup.style.padding = '10px';
        popup.style.textAlign = 'center';
        popup.style.zIndex = '9999';
        popup.style.fontFamily = 'monospace';

        const text = document.createElement('div');
        text.textContent = message;
        text.style.fontSize = '18px';

        const closeButton = document.createElement('button');
        closeButton.textContent = 'Close';
        closeButton.style.padding = '5px 10px';
        closeButton.style.backgroundColor = '#ff6600';
        closeButton.style.border = 'none';
        closeButton.style.borderRadius = '5px';
        closeButton.style.color = '#fff';
        closeButton.style.cursor = 'pointer';
        closeButton.style.marginTop = '10px';
        closeButton.addEventListener('click', () => popup.remove());

        popup.appendChild(text);
        popup.appendChild(closeButton);
        document.body.appendChild(popup);
    }

    showPopup("Educational: Blinking border + smart auto-space with line-of-sight.");

    // Shader modification for blinking border
    const originalShaderSource = WebGL2RenderingContext.prototype.shaderSource;
    WebGL2RenderingContext.prototype.shaderSource = function(shader, src) {
        const targetShader = src.includes("hlslcc_mtx4x4unity_ObjectToWorld[4]") &&
                             src.includes("hlslcc_mtx4x4unity_MatrixVP[4]");

        if (targetShader) {
            src = src.replace(/gl_Position = [\s\S]*?;/, match => {
                return match + "\n    gl_Position.xy += 0.005 * sin(gl_FragCoord.x * 10.0);"; // Blinking border
            });
        }
        return originalShaderSource.apply(this, [shader, src]);
    };

    // Simple raycast function to check obstacles between two points
    function isVisible(player, target) {
        // Assuming a function or array for walls exists in the game: window.game.walls
        const walls = window.game?.walls || [];
        const steps = 10; // number of steps for raycast
        const dx = (target.x - player.x) / steps;
        const dy = (target.y - player.y) / steps;

        for (let i = 1; i <= steps; i++) {
            const px = player.x + dx * i;
            const py = player.y + dy * i;

            for (const wall of walls) {
                if (px >= wall.x && px <= wall.x + wall.width &&
                    py >= wall.y && py <= wall.y + wall.height) {
                    return false; // obstacle found
                }
            }
        }
        return true; // clear line-of-sight
    }

    // Auto-space function
    function autoSpace() {
        const player = window.game?.player;
        const allPlayers = window.game?.players;
        if (!player || !allPlayers) return;

        allPlayers.forEach(target => {
            if (target === player) return;

            const dx = target.x - player.x;
            const dy = target.y - player.y;
            const angleToTarget = Math.atan2(dy, dx);
            const facingAngle = player.rotation; // adjust based on actual rotation

            const angleDiff = Math.abs(angleToTarget - facingAngle);
            const distance = Math.hypot(dx, dy);

            if (angleDiff < 0.2 && distance < 10 && isVisible(player, target)) {
                document.dispatchEvent(new KeyboardEvent('keydown', {key: ' ', bubbles: true}));
            }
        });
    }

    setInterval(autoSpace, 50); // check 20 times/sec
})();