Greasy Fork

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.1
// @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));
}

// Create sliders for advanced settings
function createAdvancedSettingsSlider() {
    // Ensure menu exists
    const menu = document.querySelector('#menuContent');
    if (!menu) {
        console.log('Menu not found.');
        return;
    }

    // Create container for sliders
    const settingsContainer = document.createElement('div');
    settingsContainer.innerHTML = `
        <div>
            <label for="aimbotStrength">Aimbot Strength: </label>
            <input type="range" id="aimbotStrength" min="0" max="100" value="100" style="width: 200px;">
            <span id="aimbotStrengthValue">100</span>
        </div>
        <div>
            <label for="fovSlider">Field of View (FOV): </label>
            <input type="range" id="fovSlider" min="1" max="180" value="90" style="width: 200px;">
            <span id="fovValue">90</span>
        </div>
        <div>
            <label for="smoothnessSlider">Aimbot Smoothness: </label>
            <input type="range" id="smoothnessSlider" min="1" max="100" value="50" style="width: 200px;">
            <span id="smoothnessValue">50</span>
        </div>
        <div>
            <label for="triggerbotCheckbox">Enable Triggerbot: </label>
            <input type="checkbox" id="triggerbotCheckbox" />
        </div>
    `;

    menu.appendChild(settingsContainer);

    // Get slider elements
    const aimbotStrengthSlider = document.getElementById('aimbotStrength');
    const fovSlider = document.getElementById('fovSlider');
    const smoothnessSlider = document.getElementById('smoothnessSlider');
    const triggerbotCheckbox = document.getElementById('triggerbotCheckbox');
    const aimbotStrengthDisplay = document.getElementById('aimbotStrengthValue');
    const fovDisplay = document.getElementById('fovValue');
    const smoothnessDisplay = document.getElementById('smoothnessValue');

    // Update settings on slider change
    aimbotStrengthSlider.addEventListener('input', (event) => {
        aimbotStrength = event.target.value;
        aimbotStrengthDisplay.textContent = aimbotStrength;
    });
    fovSlider.addEventListener('input', (event) => {
        fov = event.target.value;
        fovDisplay.textContent = fov;
    });
    smoothnessSlider.addEventListener('input', (event) => {
        smoothness = event.target.value;
        smoothnessDisplay.textContent = smoothness;
    });

    // Triggerbot toggle
    triggerbotCheckbox.addEventListener('change', (event) => {
        triggerbotEnabled = event.target.checked;
    });
}

// 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 and within FOV, aim at it
    if (closestTarget) {
        const angleToTarget = Math.atan2(closestTarget.y - playerPosition.y, closestTarget.x - playerPosition.x);
        const targetInFOV = isTargetInFOV(angleToTarget);

        if (targetInFOV) {
            // Apply smoothness to aim movement
            const adjustedAngle = smoothAim(angleToTarget);

            // Aim at the target
            aimAtTarget(adjustedAngle);

            // Triggerbot functionality: shoot if within range and triggerbot is enabled
            if (closestDistance < 100 && triggerbotEnabled) {
                shootAtTarget(closestTarget);
            }
        }
    }
}

// Check if the target is within the Field of View (FOV)
function isTargetInFOV(angleToTarget) {
    const fovRad = fov * (Math.PI / 180);  // Convert FOV to radians
    const angleDiff = Math.abs(angleToTarget);

    return angleDiff <= fovRad;
}

// Smooth the aiming towards the target based on smoothness
function smoothAim(angleToTarget) {
    // Simulate smoothing the angle by interpolating toward the target angle
    const currentAngle = 0; // Replace with current player view angle
    const difference = angleToTarget - currentAngle;
    const smoothFactor = smoothness / 100;

    return currentAngle + difference * smoothFactor;
}

// Function to simulate aiming at the target
function aimAtTarget(angle) {
    console.log("[Aimbot] Aiming at angle:", angle);
    // Implement mouse movement logic to aim at the target using `angle`
}

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

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

// Initialize sliders and settings
let aimbotStrength = 100;   // 0 to 100
let fov = 90;               // Field of View (1 to 180)
let smoothness = 50;        // Smoothness of aiming (1 to 100)
let triggerbotEnabled = false; // Triggerbot functionality (enabled/disabled)

// 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 advanced settings menu when the page loads
window.addEventListener('load', createAdvancedSettingsSlider);