Aimbot with Strength Slider for Fortnite (ViolentMonkey)

Aimbot for Fortnite with adjustable strength using a slider (ViolentMonkey).

目前為 2024-11-12 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Aimbot with Strength Slider for Fortnite (ViolentMonkey)
// @namespace   ViolentMonkey Scripts
// @match       https://www.xbox.com/en-US/play/launch/fortnite/*
// @grant       none
// @version     1.0
// @description Aimbot for Fortnite with adjustable strength using a slider (ViolentMonkey).
// ==/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));
}

// Simulated targets (replace this with actual dynamic target data in a real scenario)
const targets = [
    { x: 300, y: 250 }, // Target 1
    { x: 500, y: 400 }  // Target 2
];

// Placeholder for player position (this should be dynamically fetched in a real game)
const playerPosition = { x: 400, y: 300 };

// Aimbot strength slider (default 100% - full aim)
let aimbotStrength = 100; // Strength of the aimbot, 0 to 100

// Create the aimbot strength slider in the menu
function createAimbotSlider() {
    const menu = document.querySelector('#menuContent');
    const sliderContainer = document.createElement('div');
    sliderContainer.innerHTML = `
        <label for="aimbotStrength">Aimbot Strength: </label>
        <input type="range" id="aimbotStrength" min="0" max="100" value="100">
        <span id="aimbotStrengthValue">100</span>
    `;
    menu.appendChild(sliderContainer);

    const slider = document.getElementById('aimbotStrength');
    const valueDisplay = document.getElementById('aimbotStrengthValue');

    // Update aimbot strength when the slider is adjusted
    slider.addEventListener('input', (event) => {
        aimbotStrength = event.target.value;
        valueDisplay.textContent = aimbotStrength;
    });
}

// Aimbot logic to find and shoot at the closest target
function aimbot(targets) {
    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;
        }
    });

    // If a target is found, aim at it
    if (closestTarget) {
        const angleToTarget = Math.atan2(closestTarget.y - playerPosition.y, closestTarget.x - playerPosition.x);

        // Apply aimbot strength (the closer the value is to 100, the more accurate the aim)
        const adjustedAngle = adjustAim(angleToTarget, closestTarget);

        // Call function to aim at target with adjusted angle
        aimAtTarget(adjustedAngle);

        // Simulate shooting when target is within range (100px range in this case)
        if (closestDistance < 100) {
            shootAtTarget(closestTarget);
        }
    }
}

// Adjust the aiming position based on the aimbot strength
function adjustAim(angle, target) {
    const distance = calculateDistance(playerPosition.x, playerPosition.y, target.x, target.y);
    const factor = aimbotStrength / 100; // Convert strength percentage to a factor

    // Calculate the adjusted target position based on the aimbot strength
    const adjustedX = playerPosition.x + (target.x - playerPosition.x) * factor;
    const adjustedY = playerPosition.y + (target.y - playerPosition.y) * factor;

    // Recalculate the angle to the adjusted position
    return Math.atan2(adjustedY - playerPosition.y, adjustedX - playerPosition.x);
}

// Placeholder for the function to move the crosshair (using angle)
function aimAtTarget(angle) {
    console.log("[Aimbot] Aiming at angle:", angle);
    // Implement the logic to move the mouse or adjust the crosshair here
}

// Placeholder for the function to shoot at the target
function shootAtTarget(target) {
    console.log("[Aimbot] Shooting at target:", target);
    // Implement the shooting logic here (simulate a click or press space, etc.)
}

// Run the aimbot every 100ms (you can adjust this interval)
setInterval(() => {
    aimbot(targets);
}, 100);

// Create the aimbot strength slider when the page is loaded
window.addEventListener('load', createAimbotSlider);