Veck.io Aimbot & Fly Mod

Aimbot and flying features for Veck.io game

Size

13.4 KB

Version

1.1.1

Created

Mar 25, 2026

Updated

21 days ago

1// ==UserScript==
2// @name		Veck.io Aimbot & Fly Mod
3// @description		Aimbot and flying features for Veck.io game
4// @version		1.1.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// @grant		GM.getValue
8// @grant		GM.setValue
9// ==/UserScript==
10(function() {
11    'use strict';
12
13    console.log('Veck.io Aimbot & Fly Mod loaded');
14
15    // Configuration
16    let aimbotEnabled = false;
17    let flyEnabled = false;
18    let flySpeed = 2;
19
20    // UI Elements
21    let statusPanel = null;
22
23    // Create status panel
24    function createStatusPanel() {
25        statusPanel = document.createElement('div');
26        statusPanel.id = 'veck-mod-panel';
27        statusPanel.style.cssText = `
28            position: fixed;
29            top: 20px;
30            right: 20px;
31            background: rgba(0, 0, 0, 0.85);
32            color: #00ff00;
33            padding: 15px 20px;
34            border-radius: 8px;
35            font-family: 'Courier New', monospace;
36            font-size: 14px;
37            z-index: 999999;
38            border: 2px solid #00ff00;
39            box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
40            min-width: 200px;
41        `;
42        
43        statusPanel.innerHTML = `
44            <div style="font-weight: bold; margin-bottom: 10px; font-size: 16px; text-align: center; border-bottom: 1px solid #00ff00; padding-bottom: 5px;">
45                VECK.IO MOD
46            </div>
47            <div style="margin: 5px 0;">
48                <span style="color: #ffff00;">Aimbot [F1]:</span> 
49                <span id="aimbot-status" style="color: #ff0000;">OFF</span>
50            </div>
51            <div style="margin: 5px 0;">
52                <span style="color: #ffff00;">Fly [F2]:</span> 
53                <span id="fly-status" style="color: #ff0000;">OFF</span>
54            </div>
55            <div style="margin-top: 10px; font-size: 11px; color: #888; border-top: 1px solid #444; padding-top: 8px;">
56                <div>F1 - Toggle Aimbot</div>
57                <div>F2 - Toggle Fly</div>
58                <div>Space - Fly Up (when flying)</div>
59                <div>Shift - Fly Down (when flying)</div>
60            </div>
61        `;
62        
63        document.body.appendChild(statusPanel);
64        console.log('Status panel created');
65    }
66
67    // Update status display
68    function updateStatus() {
69        const aimbotStatus = document.getElementById('aimbot-status');
70        const flyStatus = document.getElementById('fly-status');
71        
72        if (aimbotStatus) {
73            aimbotStatus.textContent = aimbotEnabled ? 'ON' : 'OFF';
74            aimbotStatus.style.color = aimbotEnabled ? '#00ff00' : '#ff0000';
75        }
76        
77        if (flyStatus) {
78            flyStatus.textContent = flyEnabled ? 'ON' : 'OFF';
79            flyStatus.style.color = flyEnabled ? '#00ff00' : '#ff0000';
80        }
81    }
82
83    // Get game iframe
84    function getGameIframe() {
85        return document.getElementById('game-iframe');
86    }
87
88    // Access game window
89    function getGameWindow() {
90        const iframe = getGameIframe();
91        if (iframe) {
92            try {
93                return iframe.contentWindow;
94            } catch (e) {
95                console.error('Cannot access iframe:', e);
96                return null;
97            }
98        }
99        return null;
100    }
101
102    // Aimbot functionality
103    function setupAimbot() {
104        const gameWindow = getGameWindow();
105        if (!gameWindow) {
106            console.log('Game window not accessible yet');
107            return;
108        }
109
110        try {
111            // Hook into the game's rendering/update loop
112            const originalRequestAnimationFrame = gameWindow.requestAnimationFrame;
113            
114            gameWindow.requestAnimationFrame = function(callback) {
115                const wrappedCallback = function(timestamp) {
116                    if (aimbotEnabled) {
117                        performAimbot(gameWindow);
118                    }
119                    return callback(timestamp);
120                };
121                return originalRequestAnimationFrame.call(this, wrappedCallback);
122            };
123            
124            console.log('Aimbot hook installed');
125        } catch (e) {
126            console.error('Failed to setup aimbot:', e);
127        }
128    }
129
130    // Perform aimbot logic
131    function performAimbot(gameWindow) {
132        try {
133            // Try to find game objects in common locations
134            const possibleGameObjects = [
135                gameWindow.game,
136                gameWindow.Game,
137                gameWindow.app,
138                gameWindow.App,
139                gameWindow.scene,
140                gameWindow.Scene
141            ];
142
143            for (let gameObj of possibleGameObjects) {
144                if (gameObj && gameObj.players) {
145                    const players = gameObj.players;
146                    const localPlayer = gameObj.localPlayer || gameObj.player;
147                    
148                    if (localPlayer && players) {
149                        // Find closest enemy
150                        let closestEnemy = null;
151                        let closestDistance = Infinity;
152                        
153                        for (let player of players) {
154                            if (player !== localPlayer && player.health > 0) {
155                                const dx = player.x - localPlayer.x;
156                                const dy = player.y - localPlayer.y;
157                                const dz = player.z - localPlayer.z;
158                                const distance = Math.sqrt(dx*dx + dy*dy + dz*dz);
159                                
160                                if (distance < closestDistance) {
161                                    closestDistance = distance;
162                                    closestEnemy = player;
163                                }
164                            }
165                        }
166                        
167                        // Aim at closest enemy
168                        if (closestEnemy) {
169                            const dx = closestEnemy.x - localPlayer.x;
170                            const dy = closestEnemy.y - localPlayer.y;
171                            const dz = closestEnemy.z - localPlayer.z;
172                            
173                            localPlayer.rotation = Math.atan2(dx, dz);
174                            localPlayer.pitch = Math.atan2(dy, Math.sqrt(dx*dx + dz*dz));
175                        }
176                    }
177                    break;
178                }
179            }
180        } catch (e) {
181            // Silently fail - game structure might be different
182        }
183    }
184
185    // Flying functionality
186    function setupFly() {
187        const gameWindow = getGameWindow();
188        if (!gameWindow) {
189            console.log('Game window not accessible yet for fly');
190            return;
191        }
192
193        try {
194            // Monitor keyboard for fly controls
195            gameWindow.addEventListener('keydown', function(e) {
196                if (!flyEnabled) return;
197                
198                // Space for up, Shift for down
199                if (e.code === 'Space') {
200                    performFly(gameWindow, 'up');
201                    e.preventDefault();
202                } else if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
203                    performFly(gameWindow, 'down');
204                    e.preventDefault();
205                }
206            }, true);
207            
208            console.log('Fly controls installed');
209        } catch (e) {
210            console.error('Failed to setup fly:', e);
211        }
212    }
213
214    // Perform fly logic
215    function performFly(gameWindow, direction) {
216        try {
217            const possibleGameObjects = [
218                gameWindow.game,
219                gameWindow.Game,
220                gameWindow.app,
221                gameWindow.App,
222                gameWindow.scene,
223                gameWindow.Scene
224            ];
225
226            for (let gameObj of possibleGameObjects) {
227                if (gameObj && gameObj.localPlayer) {
228                    const player = gameObj.localPlayer;
229                    
230                    if (direction === 'up') {
231                        player.y += flySpeed;
232                        player.velocity.y = 0;
233                    } else if (direction === 'down') {
234                        player.y -= flySpeed;
235                        player.velocity.y = 0;
236                    }
237                    
238                    // Disable gravity
239                    if (player.gravity !== undefined) {
240                        player.gravity = 0;
241                    }
242                    break;
243                } else if (gameObj && gameObj.player) {
244                    const player = gameObj.player;
245                    
246                    if (direction === 'up') {
247                        player.y += flySpeed;
248                        if (player.velocity) player.velocity.y = 0;
249                    } else if (direction === 'down') {
250                        player.y -= flySpeed;
251                        if (player.velocity) player.velocity.y = 0;
252                    }
253                    
254                    if (player.gravity !== undefined) {
255                        player.gravity = 0;
256                    }
257                    break;
258                }
259            }
260        } catch (e) {
261            // Silently fail
262        }
263    }
264
265    // Keyboard controls
266    function setupKeyboardControls() {
267        document.addEventListener('keydown', function(e) {
268            // F1 - Toggle Aimbot
269            if (e.key === 'F1') {
270                e.preventDefault();
271                aimbotEnabled = !aimbotEnabled;
272                updateStatus();
273                console.log('Aimbot:', aimbotEnabled ? 'ON' : 'OFF');
274            }
275            
276            // F2 - Toggle Fly
277            if (e.key === 'F2') {
278                e.preventDefault();
279                flyEnabled = !flyEnabled;
280                updateStatus();
281                console.log('Fly:', flyEnabled ? 'ON' : 'OFF');
282                
283                // Re-enable gravity when fly is disabled
284                if (!flyEnabled) {
285                    const gameWindow = getGameWindow();
286                    if (gameWindow) {
287                        try {
288                            const possibleGameObjects = [
289                                gameWindow.game,
290                                gameWindow.Game,
291                                gameWindow.app,
292                                gameWindow.App
293                            ];
294                            
295                            for (let gameObj of possibleGameObjects) {
296                                if (gameObj && gameObj.localPlayer) {
297                                    if (gameObj.localPlayer.gravity !== undefined) {
298                                        gameObj.localPlayer.gravity = 1;
299                                    }
300                                    break;
301                                } else if (gameObj && gameObj.player) {
302                                    if (gameObj.player.gravity !== undefined) {
303                                        gameObj.player.gravity = 1;
304                                    }
305                                    break;
306                                }
307                            }
308                        } catch (e) {
309                            console.error('Error resetting gravity:', e);
310                        }
311                    }
312                }
313            }
314        });
315        
316        console.log('Keyboard controls setup complete');
317    }
318
319    // Initialize
320    function init() {
321        console.log('Initializing Veck.io Mod...');
322        
323        // Wait for page to be ready
324        if (document.readyState === 'loading') {
325            document.addEventListener('DOMContentLoaded', init);
326            return;
327        }
328        
329        // Create UI
330        createStatusPanel();
331        updateStatus();
332        
333        // Setup controls
334        setupKeyboardControls();
335        
336        // Wait for iframe to load
337        const iframe = getGameIframe();
338        if (iframe) {
339            iframe.addEventListener('load', function() {
340                console.log('Game iframe loaded, setting up mods...');
341                setTimeout(() => {
342                    setupAimbot();
343                    setupFly();
344                }, 2000);
345            });
346            
347            // If already loaded
348            if (iframe.contentWindow) {
349                setTimeout(() => {
350                    setupAimbot();
351                    setupFly();
352                }, 2000);
353            }
354        } else {
355            console.log('Waiting for iframe...');
356            // Check periodically for iframe
357            const checkIframe = setInterval(() => {
358                const iframe = getGameIframe();
359                if (iframe) {
360                    clearInterval(checkIframe);
361                    iframe.addEventListener('load', function() {
362                        console.log('Game iframe loaded, setting up mods...');
363                        setTimeout(() => {
364                            setupAimbot();
365                            setupFly();
366                        }, 2000);
367                    });
368                    
369                    if (iframe.contentWindow) {
370                        setTimeout(() => {
371                            setupAimbot();
372                            setupFly();
373                        }, 2000);
374                    }
375                }
376            }, 1000);
377        }
378        
379        console.log('Veck.io Mod initialized successfully');
380    }
381
382    // Start the extension
383    init();
384})();