Player Border + Smart Auto Space

Highlights player border + auto space when target is visible

2025-11-13 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला 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);
    });
})();