Krunker.IO Aimbot & ESP

Locks aim to the nearest player in krunker.io and shows players behind walls. Also shows a line between you and them.

目前为 2022-06-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Krunker.IO Aimbot & ESP
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.7
  5. // @description Locks aim to the nearest player in krunker.io and shows players behind walls. Also shows a line between you and them.
  6. // @author Zertalious (Zert)
  7. // @match *://krunker.io/*
  8. // @exclude *://krunker.io/social*
  9. // @exclude *://krunker.io/editor*
  10. // @icon https://www.google.com/s2/favicons?domain=krunker.io
  11. // @grant none
  12. // @run-at document-end
  13. // @require https://unpkg.com/three@latest/build/three.min.js
  14. // @antifeature ads
  15. // ==/UserScript==
  16.  
  17. let espEnabled = true;
  18. let aimbotEnabled = true;
  19. let aimbotOnRightMouse = false;
  20. let espLinesEnabled = true;
  21.  
  22. const tempVector = new THREE.Vector3();
  23.  
  24. const tempObject = new THREE.Object3D();
  25. tempObject.rotation.order = 'YXZ';
  26.  
  27. const geometry = new THREE.EdgesGeometry( new THREE.BoxGeometry( 5, 15, 5 ).translate( 0, 7.5, 0 ) );
  28.  
  29. const material = new THREE.RawShaderMaterial( {
  30. vertexShader: `
  31.  
  32. attribute vec3 position;
  33.  
  34. uniform mat4 projectionMatrix;
  35. uniform mat4 modelViewMatrix;
  36.  
  37. void main() {
  38.  
  39. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  40. gl_Position.z = 1.0;
  41.  
  42. }
  43.  
  44. `,
  45. fragmentShader: `
  46.  
  47. void main() {
  48.  
  49. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  50.  
  51. }
  52.  
  53. `
  54. } );
  55.  
  56. let scene;
  57.  
  58. const old = WeakMap.prototype.set;
  59.  
  60. WeakMap.prototype.set = function ( object ) {
  61.  
  62. if ( object.type === 'Scene' && object.name === 'Main' ) {
  63.  
  64. scene = object;
  65.  
  66. }
  67.  
  68. return old.apply( this, arguments );
  69.  
  70. }
  71.  
  72. const line = new THREE.LineSegments( new THREE.BufferGeometry(), material );
  73.  
  74. line.frustumCulled = false;
  75.  
  76. const linePositions = new THREE.BufferAttribute( new Float32Array( 100 * 2 * 3 ), 3 );
  77. line.geometry.setAttribute( 'position', linePositions );
  78.  
  79. function animate() {
  80.  
  81. window.requestAnimationFrame( animate );
  82.  
  83. if ( typeof shouldShowAd === 'undefined' || shouldShowAd === true || scene === undefined ) {
  84.  
  85. return;
  86.  
  87. }
  88.  
  89. const players = [];
  90.  
  91. let myPlayer;
  92.  
  93. for ( let i = 0; i < scene.children.length; i ++ ) {
  94.  
  95. const child = scene.children[ i ];
  96.  
  97. if ( child.type === 'Object3D' ) {
  98.  
  99. try {
  100.  
  101. if ( child.children[ 0 ].children[ 0 ].type === 'PerspectiveCamera' ) {
  102.  
  103. myPlayer = child;
  104.  
  105. } else {
  106.  
  107. players.push( child );
  108.  
  109. }
  110.  
  111. } catch ( err ) {}
  112.  
  113. }
  114.  
  115. }
  116.  
  117. let counter = 0;
  118.  
  119. let targetPlayer;
  120. let minDistance = Infinity;
  121.  
  122. tempObject.matrix.copy( myPlayer.matrix ).invert()
  123.  
  124. for ( let i = 0; i < players.length; i ++ ) {
  125.  
  126. const player = players[ i ];
  127.  
  128. if ( ! player.box ) {
  129.  
  130. const box = new THREE.LineSegments( geometry, material );
  131. box.frustumCulled = false;
  132.  
  133. player.add( box );
  134.  
  135. player.box = box;
  136.  
  137. }
  138.  
  139. if ( player.position.x === myPlayer.position.x && player.position.z === myPlayer.position.z ) {
  140.  
  141. player.box.visible = false;
  142.  
  143. if ( line.parent !== player ) {
  144.  
  145. player.add( line );
  146.  
  147. }
  148.  
  149. continue;
  150.  
  151. }
  152.  
  153. linePositions.setXYZ( counter ++, 0, 10, - 5 );
  154.  
  155. tempVector.copy( player.position );
  156.  
  157. tempVector.y += 9;
  158.  
  159. tempVector.applyMatrix4( tempObject.matrix );
  160. linePositions.setXYZ(
  161. counter ++,
  162. tempVector.x,
  163. tempVector.y,
  164. tempVector.z
  165. );
  166.  
  167. player.visible = espEnabled || player.visible;
  168.  
  169. player.box.visible = espEnabled;
  170.  
  171. const distance = player.position.distanceTo( myPlayer.position );
  172.  
  173. if ( distance < minDistance ) {
  174.  
  175. targetPlayer = player;
  176.  
  177. minDistance = distance;
  178.  
  179. }
  180.  
  181. }
  182.  
  183. linePositions.needsUpdate = true;
  184. line.geometry.setDrawRange( 0, counter );
  185.  
  186. line.visible = espLinesEnabled;
  187.  
  188. if ( aimbotEnabled === false || ( aimbotOnRightMouse && ! rightMouseDown ) || targetPlayer === undefined ) {
  189.  
  190. return;
  191.  
  192. }
  193.  
  194. tempVector.setScalar( 0 );
  195.  
  196. targetPlayer.children[ 0 ].children[ 0 ].localToWorld( tempVector );
  197.  
  198. tempObject.position.copy( myPlayer.position );
  199.  
  200. tempObject.lookAt( tempVector );
  201.  
  202. myPlayer.children[ 0 ].rotation.x = - tempObject.rotation.x;
  203. myPlayer.rotation.y = tempObject.rotation.y + Math.PI;
  204.  
  205. }
  206.  
  207. const value = parseInt( new URLSearchParams( window.location.search ).get( 'showAd' ), 16 );
  208.  
  209. const shouldShowAd = isNaN( value ) || Date.now() - value < 0 || Date.now() - value > 10 * 60 * 1000;
  210.  
  211. const el = document.createElement( 'div' );
  212.  
  213. el.innerHTML = `<style>
  214.  
  215. .dialog {
  216. position: absolute;
  217. left: 50%;
  218. top: 50%;
  219. padding: 20px;
  220. background: rgba(0, 0, 0, 0.8);
  221. border: 6px solid rgba(0, 0, 0, 0.2);
  222. color: #fff;
  223. transform: translate(-50%, -50%);
  224. text-align: center;
  225. z-index: 999999;
  226. }
  227.  
  228. .dialog * {
  229. color: #fff;
  230. }
  231.  
  232. .close {
  233. position: absolute;
  234. right: 5px;
  235. top: 5px;
  236. width: 20px;
  237. height: 20px;
  238. opacity: 0.5;
  239. cursor: pointer;
  240. }
  241.  
  242. .close:before, .close:after {
  243. content: ' ';
  244. position: absolute;
  245. left: 50%;
  246. top: 50%;
  247. width: 100%;
  248. height: 20%;
  249. transform: translate(-50%, -50%) rotate(-45deg);
  250. background: #fff;
  251. }
  252.  
  253. .close:after {
  254. transform: translate(-50%, -50%) rotate(45deg);
  255. }
  256.  
  257. .close:hover {
  258. opacity: 1;
  259. }
  260.  
  261. .btn {
  262. cursor: pointer;
  263. padding: 0.5em;
  264. background: red;
  265. border: 3px solid rgba(0, 0, 0, 0.2);
  266. }
  267.  
  268. .btn:active {
  269. transform: scale(0.8);
  270. }
  271.  
  272. .msg {
  273. position: absolute;
  274. left: 10px;
  275. bottom: 10px;
  276. color: #fff;
  277. background: rgba(0, 0, 0, 0.6);
  278. font-weight: bolder;
  279. padding: 15px;
  280. animation: msg 0.5s forwards, msg 0.5s reverse forwards 3s;
  281. z-index: 999999;
  282. pointer-events: none;
  283. }
  284.  
  285. @keyframes msg {
  286. from {
  287. transform: translate(-120%, 0);
  288. }
  289.  
  290. to {
  291. transform: none;
  292. }
  293. }
  294.  
  295. </style>
  296. <div class="msg" style="display: none;"></div>
  297. <div class="dialog">${shouldShowAd ? `<big>Loading ad...</big>` : `<div class="close" onclick="this.parentNode.style.display='none';"></div>
  298. <big>== Aimbot & ESP ==</big>
  299. <br>
  300. <br>
  301. [B] to toggle aimbot
  302. <br>
  303. [V] to toggle ESP
  304. <br>
  305. [N] to toggle ESP Lines
  306. <br>
  307. [L] to toggle aimbot on <br>right mouse hold
  308. <br>
  309. [H] to show/hide help
  310. <br>
  311. <br>
  312. By Zertalious
  313. <br>
  314. <br>
  315. <div style="display: grid; grid-template-columns: 1fr 1fr; grid-gap: 5px;">
  316. <div class="btn" onclick="window.open('https://discord.gg/K24Zxy88VM', '_blank')">Discord</div>
  317. <div class="btn" onclick="window.open('https://www.instagram.com/zertalious/', '_blank')">Instagram</div>
  318. <div class="btn" onclick="window.open('https://twitter.com/Zertalious', '_blank')">Twitter</div>
  319. <div class="btn" onclick="window.open('https://greasyfork.org/en/users/662330-zertalious', '_blank')">More scripts</div>
  320. </div>
  321. ` }
  322. </div>`;
  323.  
  324. const msgEl = el.querySelector( '.msg' );
  325. const dialogEl = el.querySelector( '.dialog' );
  326.  
  327. while ( el.children.length > 0 ) {
  328.  
  329. document.body.appendChild( el.children[ 0 ] );
  330.  
  331. }
  332.  
  333. if ( shouldShowAd ) {
  334.  
  335. const url = new URL( window.location.href );
  336.  
  337. url.searchParams.set( 'showAd', Date.now().toString( 16 ) );
  338. url.searchParams.set( 'scriptVersion', GM.info.script.version );
  339.  
  340. window.location.href = 'https://zertalious.xyz?ref=' + new TextEncoder().encode( url.href ).toString();
  341.  
  342. }
  343.  
  344. let rightMouseDown = false;
  345.  
  346. function handleMouse( event ) {
  347.  
  348. if ( event.button === 2 ) {
  349.  
  350. rightMouseDown = event.type === 'pointerdown' ? true : false;
  351.  
  352. }
  353.  
  354. }
  355.  
  356. window.addEventListener( 'pointerdown', handleMouse );
  357. window.addEventListener( 'pointerup', handleMouse );
  358.  
  359. window.addEventListener( 'keyup', function ( event ) {
  360.  
  361. switch ( event.code ) {
  362.  
  363. case 'KeyV' :
  364. espEnabled = ! espEnabled;
  365. showMsg( 'ESP', espEnabled );
  366.  
  367. break;
  368.  
  369. case 'KeyB' :
  370. aimbotEnabled = ! aimbotEnabled;
  371. showMsg( 'Aimbot', aimbotEnabled );
  372. break;
  373.  
  374. case 'KeyH' :
  375. dialogEl.style.display = dialogEl.style.display === '' ? 'none' : '';
  376. break;
  377.  
  378. case 'KeyL' :
  379.  
  380. aimbotOnRightMouse = ! aimbotOnRightMouse;
  381.  
  382. showMsg( 'Aimbot On Right Mouse Hold', aimbotOnRightMouse );
  383.  
  384. break;
  385.  
  386. case 'KeyN' :
  387.  
  388. espLinesEnabled = ! espLinesEnabled;
  389.  
  390. showMsg( 'ESP Lines', espLinesEnabled );
  391.  
  392. break;
  393.  
  394. }
  395.  
  396. } );
  397.  
  398. function showMsg( name, bool ) {
  399.  
  400. msgEl.innerText = name + ': ' + ( bool ? 'ON' : 'OFF' );
  401.  
  402. msgEl.style.display = 'none';
  403.  
  404. void msgEl.offsetWidth;
  405.  
  406. msgEl.style.display = '';
  407.  
  408. }
  409.  
  410. animate();