Greasy Fork

Greasy Fork is available in English.

but better and works Aim Assist for cloud gaming

Aim assist script with typing "bet" to toggle

当前为 2024-12-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         but better and works Aim Assist for cloud gaming
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Aim assist script with typing "bet" to toggle
// @author       You
// @match        *://*.xbox.com/*
// @grant        none
// ==/UserScript==

// Configuration settings
const AIM_ASSIST_STRENGTH = 0.8; // Aim assist strength (0-1)
const PLAYER_DETECTION_RADIUS = 150; // Player detection radius in pixels
const AIM_ASSIST_SPEED = 5; // Aim assist speed in pixels per frame

// Flags and variables
let aimAssistEnabled = false;
let aimAssistTarget = null;

// Function to detect players based on pixel color
function detectPlayers() {
    const canvas = document.querySelector('canvas');
    if (!canvas) return;

    const ctx = canvas.getContext('2d');
    const crosshairX = canvas.width / 2;
    const crosshairY = canvas.height / 2;

    // Check pixels in a circular region around the crosshair
    for (let x = crosshairX - PLAYER_DETECTION_RADIUS; x <= crosshairX + PLAYER_DETECTION_RADIUS; x++) {
        for (let y = crosshairY - PLAYER_DETECTION_RADIUS; y <= crosshairY + PLAYER_DETECTION_RADIUS; y++) {
            const distance = Math.sqrt((x - crosshairX) ** 2 + (y - crosshairY) ** 2);
            if (distance <= PLAYER_DETECTION_RADIUS) {
                const pixelColor = ctx.getImageData(x, y, 1, 1).data;

                // Adjust color matching logic as needed
                if (pixelColor[0] > 100 && pixelColor[1] < 80 && pixelColor[2] < 80) { // Example color check for a player
                    aimAssistTarget = { x, y };
                    return; // Exit once the target is found
                }
            }
        }
    }
}

// Function to apply the aim assist
function applyAimAssist() {
    const canvas = document.querySelector('canvas');
    if (!canvas || !aimAssistEnabled || !aimAssistTarget) return;

    const crosshairX = canvas.width / 2;
    const crosshairY = canvas.height / 2;

    const aimAssistDirectionX = aimAssistTarget.x - crosshairX;
    const aimAssistDirectionY = aimAssistTarget.y - crosshairY;

    const aimAssistDistance = Math.sqrt(aimAssistDirectionX ** 2 + aimAssistDirectionY ** 2);
    
    if (aimAssistDistance > 0) {
        const aimAssistSpeedX = (aimAssistDirectionX / aimAssistDistance) * AIM_ASSIST_SPEED;
        const aimAssistSpeedY = (aimAssistDirectionY / aimAssistDistance) * AIM_ASSIST_SPEED;

        // Dispatch mousemove event to apply aim assist
        const aimAssistX = crosshairX + aimAssistSpeedX;
        const aimAssistY = crosshairY + aimAssistSpeedY;
        canvas.dispatchEvent(new MouseEvent('mousemove', { clientX: aimAssistX, clientY: aimAssistY }));
    }
}

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

// Keyboard input listener
document.addEventListener('keydown', (event) => {
    const input = document.querySelector('input[type="text"]');
    if (input && input.value.toLowerCase() === 'bet') {
        toggleAimAssist();
        input.value = '';
    }
});

// Mouse move listener for player detection
const canvas = document.querySelector('canvas');
if (canvas) {
    canvas.addEventListener('mousemove', detectPlayers);
}

// Set interval for applying aim assist
setInterval(applyAimAssist, 16); // 16ms = ~60fps