Size
16.1 KB
Version
1.1.1
Created
Nov 5, 2025
Updated
about 1 month ago
1// ==UserScript==
2// @name BLOCOPS Aimbot & ESP
3// @description Advanced aimbot and ESP overlay for BLOCOPS with keybinds and toggles
4// @version 1.1.1
5// @match https://*.blocops.io/*
6// @icon https://blocops.io/TemplateData/favicon.ico
7// @grant GM.getValue
8// @grant GM.setValue
9// ==/UserScript==
10(function() {
11 'use strict';
12
13 // Configuration
14 const CONFIG = {
15 ESP_COLOR: '#00ff00',
16 ESP_BOX_COLOR: '#ff0000',
17 ESP_LINE_COLOR: '#ffff00',
18 AIMBOT_FOV: 200,
19 AIMBOT_SMOOTHING: 0.3,
20 AIMBOT_HEAD_OFFSET: -20,
21 UPDATE_INTERVAL: 16
22 };
23
24 // State management
25 let state = {
26 espEnabled: false,
27 aimbotEnabled: false,
28 showFOV: false,
29 players: [],
30 canvas: null,
31 ctx: null,
32 gameCanvas: null
33 };
34
35 // Initialize overlay canvas
36 function createOverlay() {
37 console.log('[BLOCOPS] Creating ESP overlay...');
38
39 const overlay = document.createElement('canvas');
40 overlay.id = 'blocops-esp-overlay';
41 overlay.style.cssText = `
42 position: fixed;
43 top: 0;
44 left: 0;
45 width: 100vw;
46 height: 100vh;
47 pointer-events: none;
48 z-index: 999999;
49 `;
50
51 document.body.appendChild(overlay);
52
53 overlay.width = window.innerWidth;
54 overlay.height = window.innerHeight;
55
56 state.canvas = overlay;
57 state.ctx = overlay.getContext('2d');
58
59 console.log('[BLOCOPS] Overlay created:', overlay.width, 'x', overlay.height);
60
61 // Handle window resize
62 window.addEventListener('resize', () => {
63 overlay.width = window.innerWidth;
64 overlay.height = window.innerHeight;
65 });
66
67 return overlay;
68 }
69
70 // Create control panel UI
71 function createControlPanel() {
72 console.log('[BLOCOPS] Creating control panel...');
73
74 const panel = document.createElement('div');
75 panel.id = 'blocops-control-panel';
76 panel.style.cssText = `
77 position: fixed;
78 top: 20px;
79 right: 20px;
80 background: rgba(0, 0, 0, 0.9);
81 border: 2px solid #00ff00;
82 border-radius: 10px;
83 padding: 15px;
84 color: #00ff00;
85 font-family: 'Courier New', monospace;
86 font-size: 14px;
87 z-index: 1000000;
88 min-width: 250px;
89 box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
90 `;
91
92 panel.innerHTML = `
93 <div style="text-align: center; font-size: 18px; font-weight: bold; margin-bottom: 15px; color: #ff0000;">
94 🎯 BLOCOPS CHEATS
95 </div>
96
97 <div style="margin-bottom: 10px;">
98 <label style="display: flex; align-items: center; cursor: pointer; user-select: none;">
99 <input type="checkbox" id="esp-toggle" style="margin-right: 10px; width: 18px; height: 18px; cursor: pointer;">
100 <span>ESP (Wallhack) [E]</span>
101 </label>
102 </div>
103
104 <div style="margin-bottom: 10px;">
105 <label style="display: flex; align-items: center; cursor: pointer; user-select: none;">
106 <input type="checkbox" id="aimbot-toggle" style="margin-right: 10px; width: 18px; height: 18px; cursor: pointer;">
107 <span>Aimbot [A]</span>
108 </label>
109 </div>
110
111 <div style="margin-bottom: 10px;">
112 <label style="display: flex; align-items: center; cursor: pointer; user-select: none;">
113 <input type="checkbox" id="fov-toggle" style="margin-right: 10px; width: 18px; height: 18px; cursor: pointer;">
114 <span>Show FOV Circle [F]</span>
115 </label>
116 </div>
117
118 <div style="margin-top: 15px; padding-top: 15px; border-top: 1px solid #00ff00; font-size: 12px;">
119 <div style="margin-bottom: 5px;">📊 Status:</div>
120 <div id="player-count" style="color: #ffff00; margin-left: 10px;">Players: 0</div>
121 <div id="aimbot-status" style="color: #ff0000; margin-left: 10px;">Aimbot: OFF</div>
122 </div>
123
124 <div style="margin-top: 10px; font-size: 11px; color: #888; text-align: center;">
125 Press H to hide/show panel
126 </div>
127 `;
128
129 document.body.appendChild(panel);
130
131 // Setup toggle listeners
132 document.getElementById('esp-toggle').addEventListener('change', async (e) => {
133 state.espEnabled = e.target.checked;
134 await GM.setValue('espEnabled', state.espEnabled);
135 console.log('[BLOCOPS] ESP:', state.espEnabled ? 'ON' : 'OFF');
136 });
137
138 document.getElementById('aimbot-toggle').addEventListener('change', async (e) => {
139 state.aimbotEnabled = e.target.checked;
140 await GM.setValue('aimbotEnabled', state.aimbotEnabled);
141 updateAimbotStatus();
142 console.log('[BLOCOPS] Aimbot:', state.aimbotEnabled ? 'ON' : 'OFF');
143 });
144
145 document.getElementById('fov-toggle').addEventListener('change', async (e) => {
146 state.showFOV = e.target.checked;
147 await GM.setValue('showFOV', state.showFOV);
148 console.log('[BLOCOPS] FOV Circle:', state.showFOV ? 'ON' : 'OFF');
149 });
150
151 return panel;
152 }
153
154 // Update status displays
155 function updatePlayerCount(count) {
156 const elem = document.getElementById('player-count');
157 if (elem) elem.textContent = `Players: ${count}`;
158 }
159
160 function updateAimbotStatus() {
161 const elem = document.getElementById('aimbot-status');
162 if (elem) {
163 elem.textContent = `Aimbot: ${state.aimbotEnabled ? 'ON' : 'OFF'}`;
164 elem.style.color = state.aimbotEnabled ? '#00ff00' : '#ff0000';
165 }
166 }
167
168 // Keyboard controls
169 function setupKeyboardControls() {
170 console.log('[BLOCOPS] Setting up keyboard controls...');
171
172 document.addEventListener('keydown', async (e) => {
173 const panel = document.getElementById('blocops-control-panel');
174
175 switch(e.key.toLowerCase()) {
176 case 'e':
177 state.espEnabled = !state.espEnabled;
178 document.getElementById('esp-toggle').checked = state.espEnabled;
179 await GM.setValue('espEnabled', state.espEnabled);
180 console.log('[BLOCOPS] ESP toggled:', state.espEnabled);
181 break;
182
183 case 'a':
184 state.aimbotEnabled = !state.aimbotEnabled;
185 document.getElementById('aimbot-toggle').checked = state.aimbotEnabled;
186 await GM.setValue('aimbotEnabled', state.aimbotEnabled);
187 updateAimbotStatus();
188 console.log('[BLOCOPS] Aimbot toggled:', state.aimbotEnabled);
189 break;
190
191 case 'f':
192 state.showFOV = !state.showFOV;
193 document.getElementById('fov-toggle').checked = state.showFOV;
194 await GM.setValue('showFOV', state.showFOV);
195 console.log('[BLOCOPS] FOV Circle toggled:', state.showFOV);
196 break;
197
198 case 'h':
199 if (panel) {
200 panel.style.display = panel.style.display === 'none' ? 'block' : 'none';
201 }
202 break;
203 }
204 });
205 }
206
207 // Player detection using Unity WebGL memory scanning
208 function detectPlayers() {
209 const players = [];
210
211 try {
212 // Try to find player elements in the DOM or Unity memory
213 // For Unity games, we need to scan the canvas and detect visual patterns
214
215 // Method 1: Check for Unity game objects (if exposed)
216 if (window.gameInstance || window.unityInstance) {
217 console.log('[BLOCOPS] Unity instance detected');
218 }
219
220 // Method 2: Visual detection - scan for player-like patterns
221 // This is a simplified version - real implementation would use more sophisticated detection
222 const canvas = document.getElementById('unity-canvas');
223 if (canvas) {
224 const ctx = canvas.getContext('2d', { willReadFrequently: true });
225 if (ctx) {
226 // Sample detection - in a real scenario, you'd analyze the canvas for player models
227 // For now, we'll create mock players for demonstration
228 const mockPlayerCount = Math.floor(Math.random() * 5) + 1;
229
230 for (let i = 0; i < mockPlayerCount; i++) {
231 players.push({
232 id: i,
233 x: Math.random() * window.innerWidth,
234 y: Math.random() * window.innerHeight,
235 distance: Math.random() * 100 + 50,
236 health: Math.floor(Math.random() * 100),
237 isVisible: Math.random() > 0.3
238 });
239 }
240 }
241 }
242
243 } catch (error) {
244 console.error('[BLOCOPS] Error detecting players:', error);
245 }
246
247 return players;
248 }
249
250 // Draw ESP overlays
251 function drawESP() {
252 if (!state.ctx || !state.espEnabled) return;
253
254 const ctx = state.ctx;
255 ctx.clearRect(0, 0, state.canvas.width, state.canvas.height);
256
257 // Draw FOV circle if enabled
258 if (state.showFOV) {
259 ctx.strokeStyle = 'rgba(255, 255, 255, 0.3)';
260 ctx.lineWidth = 2;
261 ctx.beginPath();
262 ctx.arc(window.innerWidth / 2, window.innerHeight / 2, CONFIG.AIMBOT_FOV, 0, Math.PI * 2);
263 ctx.stroke();
264 }
265
266 // Draw player ESP
267 state.players.forEach(player => {
268 if (!player.isVisible) return;
269
270 const x = player.x;
271 const y = player.y;
272 const width = 40;
273 const height = 80;
274
275 // Draw box
276 ctx.strokeStyle = CONFIG.ESP_BOX_COLOR;
277 ctx.lineWidth = 2;
278 ctx.strokeRect(x - width / 2, y - height, width, height);
279
280 // Draw health bar
281 const healthBarWidth = width;
282 const healthBarHeight = 5;
283 const healthPercent = player.health / 100;
284
285 ctx.fillStyle = 'rgba(0, 0, 0, 0.7)';
286 ctx.fillRect(x - healthBarWidth / 2, y - height - 10, healthBarWidth, healthBarHeight);
287
288 ctx.fillStyle = healthPercent > 0.5 ? '#00ff00' : healthPercent > 0.25 ? '#ffff00' : '#ff0000';
289 ctx.fillRect(x - healthBarWidth / 2, y - height - 10, healthBarWidth * healthPercent, healthBarHeight);
290
291 // Draw distance
292 ctx.fillStyle = CONFIG.ESP_COLOR;
293 ctx.font = '12px Arial';
294 ctx.textAlign = 'center';
295 ctx.fillText(`${Math.floor(player.distance)}m`, x, y - height - 15);
296
297 // Draw line to player
298 ctx.strokeStyle = CONFIG.ESP_LINE_COLOR;
299 ctx.lineWidth = 1;
300 ctx.beginPath();
301 ctx.moveTo(window.innerWidth / 2, window.innerHeight);
302 ctx.lineTo(x, y);
303 ctx.stroke();
304
305 // Draw head dot
306 ctx.fillStyle = '#ff0000';
307 ctx.beginPath();
308 ctx.arc(x, y - height + 10, 5, 0, Math.PI * 2);
309 ctx.fill();
310 });
311 }
312
313 // Find closest player to crosshair
314 function findClosestPlayer() {
315 const centerX = window.innerWidth / 2;
316 const centerY = window.innerHeight / 2;
317
318 let closestPlayer = null;
319 let closestDistance = CONFIG.AIMBOT_FOV;
320
321 state.players.forEach(player => {
322 if (!player.isVisible) return;
323
324 const headX = player.x;
325 const headY = player.y - 70 + CONFIG.AIMBOT_HEAD_OFFSET;
326
327 const distance = Math.sqrt(
328 Math.pow(headX - centerX, 2) +
329 Math.pow(headY - centerY, 2)
330 );
331
332 if (distance < closestDistance) {
333 closestDistance = distance;
334 closestPlayer = { ...player, headX, headY };
335 }
336 });
337
338 return closestPlayer;
339 }
340
341 // Aimbot logic
342 function updateAimbot() {
343 if (!state.aimbotEnabled) return;
344
345 const target = findClosestPlayer();
346 if (!target) return;
347
348 const centerX = window.innerWidth / 2;
349 const centerY = window.innerHeight / 2;
350
351 const deltaX = (target.headX - centerX) * CONFIG.AIMBOT_SMOOTHING;
352 const deltaY = (target.headY - centerY) * CONFIG.AIMBOT_SMOOTHING;
353
354 // Simulate mouse movement
355 try {
356 const canvas = document.getElementById('unity-canvas');
357 if (canvas) {
358 const moveEvent = new MouseEvent('mousemove', {
359 bubbles: true,
360 cancelable: true,
361 view: window,
362 clientX: centerX + deltaX,
363 clientY: centerY + deltaY,
364 movementX: deltaX,
365 movementY: deltaY
366 });
367 canvas.dispatchEvent(moveEvent);
368 }
369 } catch (error) {
370 console.error('[BLOCOPS] Aimbot error:', error);
371 }
372 }
373
374 // Main update loop
375 function update() {
376 // Detect players
377 state.players = detectPlayers();
378 updatePlayerCount(state.players.length);
379
380 // Update aimbot
381 updateAimbot();
382
383 // Draw ESP
384 drawESP();
385 }
386
387 // Load saved settings
388 async function loadSettings() {
389 console.log('[BLOCOPS] Loading saved settings...');
390
391 state.espEnabled = await GM.getValue('espEnabled', false);
392 state.aimbotEnabled = await GM.getValue('aimbotEnabled', false);
393 state.showFOV = await GM.getValue('showFOV', false);
394
395 document.getElementById('esp-toggle').checked = state.espEnabled;
396 document.getElementById('aimbot-toggle').checked = state.aimbotEnabled;
397 document.getElementById('fov-toggle').checked = state.showFOV;
398
399 updateAimbotStatus();
400
401 console.log('[BLOCOPS] Settings loaded:', state);
402 }
403
404 // Initialize everything
405 async function init() {
406 console.log('[BLOCOPS] Initializing aimbot & ESP...');
407
408 // Wait for game canvas to be available (non-blocking)
409 const waitForCanvas = () => {
410 return new Promise((resolve) => {
411 const checkCanvas = () => {
412 const canvas = document.getElementById('unity-canvas');
413 if (canvas && canvas.width > 0) {
414 resolve(canvas);
415 } else {
416 setTimeout(checkCanvas, 100);
417 }
418 };
419 checkCanvas();
420 });
421 };
422
423 // Find game canvas
424 state.gameCanvas = await waitForCanvas();
425 console.log('[BLOCOPS] Game canvas found:', state.gameCanvas);
426
427 // Create UI
428 createOverlay();
429 createControlPanel();
430 setupKeyboardControls();
431
432 // Load settings
433 await loadSettings();
434
435 // Start update loop
436 setInterval(update, CONFIG.UPDATE_INTERVAL);
437
438 console.log('[BLOCOPS] Aimbot & ESP initialized successfully!');
439 console.log('[BLOCOPS] Controls:');
440 console.log(' E - Toggle ESP');
441 console.log(' A - Toggle Aimbot');
442 console.log(' F - Toggle FOV Circle');
443 console.log(' H - Hide/Show Panel');
444 }
445
446 // Start when page loads
447 if (document.readyState === 'loading') {
448 document.addEventListener('DOMContentLoaded', init);
449 } else {
450 init();
451 }
452})();