Player Border + Smart Auto Space

Highlights player border + auto space when target is visible

اعتبارا من 13-11-2025. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Player Border + Smart Auto Space
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Highlights player border + auto space when target is visible
// @author       Havvingyy
// @match        *://smashkarts.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function waitForGame(callback) {
        const interval = setInterval(() => {
            if (window.game && window.game.player && window.game.players) {
                clearInterval(interval);
                callback();
            }
        }, 100);
    }

    waitForGame(() => {
        // Popup
        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';
        popup.innerHTML = 'Player Border + Smart Auto-Space Enabled.<button style="margin-left:10px;background:#ff6600;color:#fff;border:none;padding:5px 10px;border-radius:5px;cursor:pointer;" onclick="this.parentNode.remove()">Close</button>';
        document.body.appendChild(popup);

        // Shader override for blinking border
        const originalShader = WebGL2RenderingContext.prototype.shaderSource;
        WebGL2RenderingContext.prototype.shaderSource = function(shader, src) {
            if (src.includes("hlslcc_mtx4x4unity_ObjectToWorld[4]") &&
                src.includes("hlslcc_mtx4x4unity_MatrixVP[4]")) {
                src = src.replace(/gl_Position = [\s\S]*?;/, m => m + "\n    gl_Position.xy += 0.005 * sin(gl_FragCoord.x * 10.0);");
            }
            return originalShader.apply(this, [shader, src]);
        };

        // Raycast line-of-sight check
        function isVisible(player, target) {
            const walls = window.game.walls || [];
            const steps = 10;
            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, py = player.y + dy*i;
                if (walls.some(w => px >= w.x && px <= w.x + w.width && py >= w.y && py <= w.y + w.height)) return false;
            }
            return true;
        }

        // Smart auto-space
        function autoSpace() {
            const player = window.game.player;
            const allPlayers = window.game.players;
            allPlayers.forEach(t => {
                if (t === player) return;
                const dx = t.x - player.x, dy = t.y - player.y;
                const angleDiff = Math.abs(Math.atan2(dy, dx) - player.rotation);
                if (angleDiff < 0.2 && Math.hypot(dx, dy) < 10 && isVisible(player, t)) {
                    document.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', bubbles: true }));
                }
            });
        }
        setInterval(autoSpace, 50);
    });
})();