Veck.io Aimbot

Auto-aim extension for Veck.io game with color targeting and smoothing controls

Size

7.6 KB

Version

1.0.1

Created

Apr 3, 2026

Updated

13 days ago

1// ==UserScript==
2// @name		Veck.io Aimbot
3// @description		Auto-aim extension for Veck.io game with color targeting and smoothing controls
4// @version		1.0.1
5// @match		https://*.crazygames.com/*
6// @icon		https://imgs.crazygames.com/favicons/touch-icon.png?metadata=none&quality=60&width=32&height=32&fit=crop&format=png
7// ==/UserScript==
8(function() {
9    'use strict';
10
11    console.log('[Veck.io Aimbot] Initializing...');
12
13    // State
14    let enabled = false;
15    let aimbotInterval = null;
16    let targetColor = '#FF0000'; // Enemy color (red by default)
17    let smoothing = 0.3; // Aim smoothing (0-1)
18
19    // Create UI
20    function createUI() {
21        const container = document.createElement('div');
22        container.id = 'veck-aimbot-ui';
23        container.style.cssText = `
24            position: fixed;
25            top: 10px;
26            right: 10px;
27            background: rgba(0, 0, 0, 0.85);
28            border: 2px solid #00ff00;
29            border-radius: 8px;
30            padding: 15px;
31            z-index: 999999;
32            font-family: Arial, sans-serif;
33            color: white;
34            min-width: 200px;
35        `;
36
37        container.innerHTML = `
38            <div style="font-size: 16px; font-weight: bold; margin-bottom: 10px; color: #00ff00;">
39                🎯 Veck.io Aimbot
40            </div>
41            <div style="margin-bottom: 10px;">
42                <label style="display: flex; align-items: center; cursor: pointer;">
43                    <input type="checkbox" id="aimbot-toggle" style="margin-right: 8px; width: 18px; height: 18px;">
44                    <span>Enable Aimbot</span>
45                </label>
46            </div>
47            <div style="margin-bottom: 10px;">
48                <label style="display: block; margin-bottom: 5px;">Smoothing: <span id="smooth-val">0.3</span></label>
49                <input type="range" id="aimbot-smooth" min="0" max="1" step="0.1" value="0.3" style="width: 100%;">
50            </div>
51            <div style="margin-bottom: 10px;">
52                <label style="display: block; margin-bottom: 5px;">Target Color:</label>
53                <input type="color" id="aimbot-color" value="#FF0000" style="width: 100%; height: 30px;">
54            </div>
55            <div style="font-size: 12px; color: #888;">
56                Press 'V' to toggle aimbot
57            </div>
58        `;
59
60        document.body.appendChild(container);
61
62        // Event listeners
63        document.getElementById('aimbot-toggle').addEventListener('change', (e) => {
64            enabled = e.target.checked;
65            if (enabled) {
66                startAimbot();
67            } else {
68                stopAimbot();
69            }
70        });
71
72        document.getElementById('aimbot-smooth').addEventListener('input', (e) => {
73            smoothing = parseFloat(e.target.value);
74            document.getElementById('smooth-val').textContent = smoothing.toFixed(1);
75        });
76
77        document.getElementById('aimbot-color').addEventListener('input', (e) => {
78            targetColor = e.target.value;
79        });
80    }
81
82    // Find game canvas
83    function getGameCanvas() {
84        const iframe = document.querySelectorAll('iframe')[0];
85        if (iframe && iframe.contentDocument) {
86            return iframe.contentDocument.querySelector('canvas');
87        }
88        return document.querySelector('canvas');
89    }
90
91    // Color matching
92    function colorMatch(r, g, b, targetR, targetG, targetB, tolerance = 50) {
93        return Math.abs(r - targetR) < tolerance &&
94               Math.abs(g - targetG) < tolerance &&
95               Math.abs(b - targetB) < tolerance;
96    }
97
98    // Find target position
99    function findTarget(canvas) {
100        if (!canvas) return null;
101
102        const ctx = canvas.getContext('2d', { willReadFrequently: true });
103        if (!ctx) return null;
104
105        const width = canvas.width;
106        const height = canvas.height;
107        const centerX = width / 2;
108        const centerY = height / 2;
109
110        // Sample pixels to find target
111        const imageData = ctx.getImageData(0, 0, width, height);
112        const data = imageData.data;
113
114        // Parse target color
115        const targetR = parseInt(targetColor.slice(1, 3), 16);
116        const targetG = parseInt(targetColor.slice(3, 5), 16);
117        const targetB = parseInt(targetColor.slice(5, 7), 16);
118
119        let closestTarget = null;
120        let closestDistance = Infinity;
121
122        // Scan for target color (sample every 10 pixels for performance)
123        for (let y = 0; y < height; y += 10) {
124            for (let x = 0; x < width; x += 10) {
125                const index = (y * width + x) * 4;
126                const r = data[index];
127                const g = data[index + 1];
128                const b = data[index + 2];
129
130                if (colorMatch(r, g, b, targetR, targetG, targetB, 60)) {
131                    const distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
132                    if (distance < closestDistance) {
133                        closestDistance = distance;
134                        closestTarget = { x, y };
135                    }
136                }
137            }
138        }
139
140        return closestTarget;
141    }
142
143    // Move mouse toward target
144    function moveMouseToTarget(canvas, target) {
145        if (!canvas || !target) return;
146
147        const rect = canvas.getBoundingClientRect();
148        const centerX = rect.left + rect.width / 2;
149        const centerY = rect.top + rect.height / 2;
150
151        const targetX = rect.left + (target.x / canvas.width) * rect.width;
152        const targetY = rect.top + (target.y / canvas.height) * rect.height;
153
154        // Calculate movement with smoothing
155        const dx = (targetX - centerX) * smoothing;
156        const dy = (targetY - centerY) * smoothing;
157
158        // Simulate mouse movement
159        const event = new MouseEvent('mousemove', {
160            clientX: centerX + dx,
161            clientY: centerY + dy,
162            bubbles: true
163        });
164
165        canvas.dispatchEvent(event);
166    }
167
168    // Aimbot loop
169    function aimbotLoop() {
170        if (!enabled) return;
171
172        const canvas = getGameCanvas();
173        if (!canvas) {
174            console.log('[Veck.io Aimbot] Canvas not found');
175            return;
176        }
177
178        const target = findTarget(canvas);
179        if (target) {
180            moveMouseToTarget(canvas, target);
181        }
182    }
183
184    // Start aimbot
185    function startAimbot() {
186        if (aimbotInterval) return;
187        console.log('[Veck.io Aimbot] Started');
188        aimbotInterval = setInterval(aimbotLoop, 16); // ~60 FPS
189    }
190
191    // Stop aimbot
192    function stopAimbot() {
193        if (aimbotInterval) {
194            clearInterval(aimbotInterval);
195            aimbotInterval = null;
196        }
197        console.log('[Veck.io Aimbot] Stopped');
198    }
199
200    // Keyboard shortcut
201    document.addEventListener('keydown', (e) => {
202        if (e.key.toLowerCase() === 'v') {
203            enabled = !enabled;
204            const toggle = document.getElementById('aimbot-toggle');
205            if (toggle) {
206                toggle.checked = enabled;
207            }
208            if (enabled) {
209                startAimbot();
210            } else {
211                stopAimbot();
212            }
213        }
214    });
215
216    // Wait for page to load
217    function init() {
218        console.log('[Veck.io Aimbot] Waiting for game to load...');
219        
220        const checkInterval = setInterval(() => {
221            const iframe = document.querySelectorAll('iframe')[0];
222            if (iframe) {
223                clearInterval(checkInterval);
224                setTimeout(createUI, 1000);
225            }
226        }, 500);
227    }
228
229    // Start
230    if (document.readyState === 'loading') {
231        document.addEventListener('DOMContentLoaded', init);
232    } else {
233        init();
234    }
235
236})();