Greasy Fork

Greasy Fork is available in English.

Xbox Cloud Gaming Aimbot (Fortnite)

Aimbot script for Fortnite on Xbox Cloud Gaming

当前为 2024-11-14 提交的版本,查看 最新版本

// ==UserScript==
// @name        Xbox Cloud Gaming Aimbot (Fortnite)
// @namespace   ViolentMonkey Scripts
// @match       https://www.xbox.com/en-US/play/launch/fortnite/*
// @grant       none
// @version     1.1
// @description Aimbot script for Fortnite on Xbox Cloud Gaming
// ==/UserScript==

// Helper function to calculate distance between player and target
function calculateDistance(x1, y1, x2, y2) {
    return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
}

// Placeholder for player position (replace with real data)
const playerPosition = { x: 400, y: 300 }; // Example position for the player

// Smoothness factor for aiming (higher value = smoother but slower)
const smoothness = 0.1; // Adjust for smoother or more precise movements (lower is smoother)
const shootingRange = 50; // Max aimbot range for shooting (in pixels)

// AI lock-on variables
let currentLockedTarget = null;
let currentAngle = 0;
let aimbotEnabled = false;
// Function to simulate the aimbot logic (find closest target)
function aimbot(targets) {
    if (!aimbotEnabled) return;

    let closestTarget = null;
    let closestDistance = Infinity;

    // Find the closest target to the player
    targets.forEach(target => {
        const distance = calculateDistance(playerPosition.x, playerPosition.y, target.x, target.y);
        if (distance < closestDistance) {
            closestDistance = distance;
            closestTarget = target;
        }
    });

    // Lock-on to the closest target if one is found
    if (closestTarget && closestTarget !== currentLockedTarget) {
        currentLockedTarget = closestTarget;
    }

    // If a locked target exists, aim and shoot
    if (currentLockedTarget) {
        const angleToTarget = Math.atan2(currentLockedTarget.y - playerPosition.y, currentLockedTarget.x - playerPosition.x);
        const adjustedAngle = smoothAim(angleToTarget);
        aimAtTarget(adjustedAngle);

        // Triggerbot functionality: shoot if within range
        if (closestDistance < shootingRange) {
            shootAtTarget(currentLockedTarget);
        }
    }
}
// Smooth the aiming towards the target based on smoothness
function smoothAim(angleToTarget) {
    const difference = angleToTarget - currentAngle;
    const smoothFactor = smoothness;

    // Prevent overshooting by ensuring angle is between -π and π
    if (difference > Math.PI) {
        return currentAngle + (difference - 2 * Math.PI) * smoothFactor;
    } else if (difference < -Math.PI) {
        return currentAngle + (difference + 2 * Math.PI) * smoothFactor;
    }

    return currentAngle + difference * smoothFactor;
}

// Function to simulate aiming at the target with smoother transitions
function aimAtTarget(angle) {
    currentAngle = angle; // Update the player's view angle
    console.log("[Aimbot] Aiming at angle:", angle);
}

// Function to simulate shooting at the target
function shootAtTarget(target) {
    console.log("[Aimbot] Shooting at target:", target);
}
// Simulate targets (replace this with actual dynamic target data in a real game)
const targets = [
    { x: 300, y: 250 }, // Target 1
    { x: 500, y: 400 }  // Target 2
];

// Run the aimbot every 100ms (you can adjust this interval)
setInterval(() => {
    aimbot(targets);
}, 100);
// Create the menu for user interface
let menuVisible = true;
let menuMinimized = false;

const menu = document.createElement('div');
menu.style.position = 'fixed';
menu.style.top = '20px';
menu.style.left = '20px';
menu.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
menu.style.color = '#FFF';
menu.style.padding = '10px';
menu.style.fontSize = '16px';
menu.style.fontFamily = '"Product Sans", sans-serif';
menu.style.zIndex = '10001';
menu.style.cursor = 'move'; // Make the menu draggable
menu.innerHTML = `
    <div style="display: flex; justify-content: space-between;">
        <span id="menuTitle">Xbox Aimbot</span>
        <span id="menuMinimize" style="cursor: pointer;">-</span>
    </div>
    <div id="menuContent">
        <button id="toggleAimbot">Disable Aimbot</button>
        <p id="aimbotStatus">Aimbot is OFF</p>
    </div>
`;
document.body.appendChild(menu);

// Menu dragging functionality
let isDragging = false;
let offsetX, offsetY;

menu.addEventListener('mousedown', (event) => {
    isDragging = true;
    offsetX = event.clientX - menu.offsetLeft;
    offsetY = event.clientY - menu.offsetTop;
    menu.style.transition = 'none'; // Disable smooth transition while dragging
});

document.addEventListener('mousemove', (event) => {
    if (isDragging) {
        menu.style.left = `${event.clientX - offsetX}px`;
        menu.style.top = `${event.clientY - offsetY}px`;
    }
});

document.addEventListener('mouseup', () => {
    isDragging = false;
    menu.style.transition = 'all 0.3s'; // Re-enable smooth transition after drag
});
// Minimize/Restore menu functionality
const menuMinimizeButton = document.getElementById('menuMinimize');
const menuContent = document.getElementById('menuContent');

menuMinimizeButton.addEventListener('click', () => {
    if (menuMinimized) {
        menuContent.style.display = 'block';
        menuMinimizeButton.textContent = '-';
    } else {
        menuContent.style.display = 'none';
        menuMinimizeButton.textContent = '+';
    }
    menuMinimized = !menuMinimized;
});

// Toggle Aimbot functionality from the menu
const toggleAimbotButton = document.getElementById('toggleAimbot');
const aimbotStatusText = document.getElementById('aimbotStatus'); // Element to show the aimbot status

toggleAimbotButton.addEventListener('click', () => {
    // Toggle the aimbot state
    aimbotEnabled = !aimbotEnabled;

    // Change the button text based on the aimbot state
    if (aimbotEnabled) {
        toggleAimbotButton.textContent = 'Disable Aimbot';  // Change to 'Disable Aimbot' if enabled
        aimbotStatusText.textContent = 'Aimbot is ON';      // Update status to 'Aimbot is ON'
    } else {
        toggleAimbotButton.textContent = 'Enable Aimbot';   // Change to 'Enable Aimbot' if disabled
        aimbotStatusText.textContent = 'Aimbot is OFF';     // Update status to 'Aimbot is OFF'
    }

    // Log the current state of the aimbot
    console.log(`[Aimbot] Aimbot ${aimbotEnabled ? 'enabled' : 'disabled'}`);
});