My First Multi-Player Radar

Scans and logs multiple players simultaneously using engine components

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         My First Multi-Player Radar
// @namespace    http://tampermonkey.net
// @version      1.1
// @description  Scans and logs multiple players simultaneously using engine components
// @author       You
// @match        *://*.bloxd.io/*
// @match        *://*.bloxdhop.io/*
// @match        *://*://*
// @run-at       document-body
// @grant        none
// ==/UserScript==


(function() {
    'use strict';

    let savedEngine = null;

    // 1. THE ANTENNA: Hook into the game's loading files to grab the engine
    Object.defineProperty(Function.prototype, 'call', {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function (thisArg, ...args) {
            const core = args[0];
            // If we catch a piece of code containing 'entities' and 'bloxd', save it!
            if (core && core.entities && core.bloxd) {
                savedEngine = core;
                console.log("Successfully hooked into the Bloxd engine!");
            }
            return Function.prototype.call.apply(this, [thisArg, ...args]);
        }
    });

    // 2. THE MULTI-TARGET MONITOR LOOP
    setInterval(() => {
        if (!savedEngine) return;

        // Fetch your own position (You are always ID 1)
        let pos = savedEngine.entities.getState(1, "position")?.position;
        if (!pos) return;

        // DYNAMIC SCANNER: Extract a fresh list of EVERY entity currently loaded around you
        let allPlayerIds = Object.keys(savedEngine.entities.components.position);

        // This loop automatically repeats your distance math for every single active ID found
        allPlayerIds.forEach(id => {
            if (id == "1") return; // Skip yourself to prevent self-targeting

            // Fetch the current loop player's coordinate array dynamically
            let enemypos = savedEngine.entities.getState(id, "position")?.position;
            if (!enemypos) return;

            // FIXED VECTOR MATH: Subtracting individual elements keeps the calculations stable
            let dx = pos[0] - enemypos[0];
            let dy = pos[1] - enemypos[1];
            let dz = pos[2] - enemypos[2];
            let distance = Math.sqrt(dx*dx + dy*dy + dz*dz);

            // Execute the action block if this specific player is within range
            if (distance <= 6.0) {
                console.log(`attack ID: ${id} | Distance: ${distance.toFixed(2)}`);
            }
        });
    }, 100);

})();