Greasy Fork

Greasy Fork is available in English.

Lunar Client Aimbot (Smooth HD Precision Toggle)

Aimbot script with smooth precision and toggle functionality (V key), styled with Product Sans, with draggable menu and Lunar Client text

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

// ==UserScript==
// @name        Lunar Client Aimbot (Smooth HD Precision Toggle)
// @namespace   ViolentMonkey Scripts
// @match       https://www.xbox.com/en-US/play/launch/fortnite/*
// @grant       none
// @version     1.4
// @description Aimbot script with smooth precision and toggle functionality (V key), styled with Product Sans, with draggable menu and Lunar Client text
// ==/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));
}

// Toggle the aimbot on and off
let aimbotEnabled = false;

// Smoothness factor for aiming (higher value = smoother but slower)
const smoothness = 0.05; // Adjust this for smoother movements (lower is smoother)

// Maximum aimbot range (in pixels) for auto-shooting
const shootingRange = 100; // Change this value based on your needs

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

// 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 the aimbot is enabled
    if (closestTarget && aimbotEnabled) {
        const angleToTarget = Math.atan2(closestTarget.y - playerPosition.y, closestTarget.x - playerPosition.x);
        const adjustedAngle = smoothAim(angleToTarget);

        // Aim at the target
        aimAtTarget(adjustedAngle);

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

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

    return currentAngle + difference * smoothFactor;
}

// Function to simulate aiming at the target with smoother transitions
function aimAtTarget(angle) {
    console.log("[Aimbot] Aiming at angle:", angle);
    // Here, you would implement mouse movement logic to aim at the target
    // For simulation, let's assume we just output the angle
}

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

// 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);

// Keydown event to toggle the aimbot on/off with the "V" key
document.addEventListener('keydown', (event) => {
    if (event.key === 'v' || event.key === 'V') {
        aimbotEnabled = !aimbotEnabled;
        console.log(`[Aimbot] Aimbot ${aimbotEnabled ? 'enabled' : 'disabled'}`);
    }
});

// Inject custom crosshair for the HD-like effect
function createCrosshair() {
    const crosshair = document.createElement('img');
    crosshair.src = 'https://static-00.iconduck.com/assets.00/crosshair-icon-2048x2048-5h6w9rqc.png';
    crosshair.style.position = 'absolute';
    crosshair.style.top = '50%';
    crosshair.style.left = '50%';
    crosshair.style.transform = 'translate(-50%, -50%)';
    crosshair.style.width = '50px';
    crosshair.style.height = '50px';
    crosshair.style.pointerEvents = 'none';
    crosshair.style.zIndex = '10000';
    document.body.appendChild(crosshair);
}

// Create a link to Google Fonts to import Roboto or fallback to Product Sans (if available)
const link = document.createElement('link');
link.href = "https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"; // Change this URL for other fonts if necessary
link.rel = 'stylesheet';
document.head.appendChild(link);

// Create and toggle 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", "Roboto", sans-serif';  // Use Product Sans or fallback to Roboto
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">Lunar Client</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');
toggleAimbotButton.addEventListener('click', () => {
    aimbotEnabled = !aimbotEnabled;
    toggleAimbotButton.textContent = aimbotEnabled ? 'Disable Aimbot' : 'Enable Aimbot';
    const statusText = aimbotEnabled ? 'Aimbot is ON' : 'Aimbot is OFF';
    document.getElementById('aimbotStatus').textContent = statusText;
    console.log(`[Aimbot] Aimbot ${aimbotEnabled ? 'enabled' : 'disabled'}`);
});

// Inject crosshair
createCrosshair();