Greasy Fork

Xbox Cloud Fortnite Aimbot with FOV

Draw boxes around detected players, aim assist, and auto fire for Fortnite

目前为 2024-12-10 提交的版本。查看 最新版本

// ==UserScript==
// @name         Xbox Cloud Fortnite Aimbot with FOV
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Draw boxes around detected players, aim assist, and auto fire for Fortnite
// @author       You
// @match        https://www.xbox.com/en-US/play/launch/fortnite/BT5P2X999VH2
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let aimAssistEnabled = false;
    let fov = 90; // Default FOV value
    const canvas = document.querySelector('canvas');
    const ctx = canvas.getContext('2d');

    function toggleAimAssist() {
        aimAssistEnabled = !aimAssistEnabled;
        console.log(`Aim assist ${aimAssistEnabled ? 'enabled' : 'disabled'}`);
    }

    function isTargetInFOV(targetX, targetY) {
        const crosshairX = canvas.width / 2;
        const crosshairY = canvas.height / 2;
        const angleToTarget = Math.atan2(targetY - crosshairY, targetX - crosshairX) * (180 / Math.PI);
        const fovHalf = fov / 2;

        return Math.abs(angleToTarget) <= fovHalf;
    }

    function detectPlayers() {
        // Logic to find players in the game
        const players = document.querySelectorAll('.target-element'); // Replace this selector with the actual player class
        return Array.from(players).map(player => {
            const rect = player.getBoundingClientRect();
            return {
                x: rect.x + rect.width / 2,
                y: rect.y + rect.height / 2
            };
        });
    }

    function drawPlayerBoxes(players) {
        ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear previous frames
        players.forEach(player => {
            ctx.strokeStyle = 'red';   // Change color as needed
            ctx.strokeRect(
                player.x - 25, // Adjust width as needed
                player.y - 25, // Adjust height as needed
                50,            // Width of the box
                50             // Height of the box
            );
        });
    }

    function applyAimAssist() {
        if (!aimAssistEnabled) return;

        const players = detectPlayers();
        const crosshairX = canvas.width / 2;
        const crosshairY = canvas.height / 2;

        // Check if any player is in the field of view
        let target;
        for (const player of players) {
            if (isTargetInFOV(player.x, player.y)) {
                target = player; // Set the target if within FOV
                break; // Break out after finding the first target
            }
        }

        if (target) {
            const aimAssistDirectionX = target.x - crosshairX;
            const aimAssistDirectionY = target.y - crosshairY;
            const aimAssistDistance = Math.sqrt(aimAssistDirectionX ** 2 + aimAssistDirectionY ** 2);
            const aimAssistSpeedX = (aimAssistDirectionX / aimAssistDistance) * 5; // Adjust speed as needed
            const aimAssistSpeedY = (aimAssistDirectionY / aimAssistDistance) * 5;

            const aimAssistX = crosshairX + aimAssistSpeedX;
            const aimAssistY = crosshairY + aimAssistSpeedY;

            canvas.dispatchEvent(new MouseEvent('mousemove', { clientX: aimAssistX, clientY: aimAssistY }));
        }
        
        // Draw boxes around detected players
        drawPlayerBoxes(players);
    }

    document.addEventListener('keydown', (event) => {
        if (event.key === 'F1') {
            toggleAimAssist();
        }
    });

    setInterval(applyAimAssist, 16); // 60fps

    console.log("Tampermonkey script loaded for Fortnite with FOV!");
})();