// ==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 // @downloadURL 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