Advertisement
TypicalModder

Krunker.io Aimbot Script

Oct 29th, 2019
57,265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.21 KB | None | 0 0
  1. // ==UserScript==
  2. // @name ZaresPlus X krunker.io Hack
  3. // @namespace youtube.com/zaresplusx
  4. // @version 1.7.9
  5. // @author ZaresPlus X
  6. // @match *://krunker.io/*
  7. // @run-at document-start
  8. // @grant unsafeWindow
  9. // ==/UserScript==
  10.  
  11. function hack(name, keybind, status) {
  12. this.name = name;
  13. this.keybind = keybind;
  14. this.status = status;
  15. }
  16.  
  17. unsafeWindow.getHack = function(name) {
  18. var returned;
  19. unsafeWindow.hacks.forEach(function(hack){
  20. if(hack.name === name) returned = hack;
  21. });
  22. return returned;
  23. }
  24.  
  25. unsafeWindow.hacks = [];
  26. unsafeWindow.hacks.push(new hack("Aimbot", "1", true));
  27. unsafeWindow.hacks.push(new hack("ESP", "2", true));
  28. unsafeWindow.hacks.push(new hack("BHop", "3", true));
  29. unsafeWindow.hacks.push(new hack("AutoReload", "4", true));
  30. unsafeWindow.hacks.push(new hack("GUI", "5", true));
  31.  
  32. window.addEventListener('keydown', (key) => {
  33. unsafeWindow.hacks.forEach(function(hack) {
  34. if(hack.keybind === String.fromCharCode(key.keyCode)) {
  35. hack.status = !hack.status;
  36. }
  37. });
  38. });
  39.  
  40. var GUI = document.createElement('div');
  41. GUI.id = "GUI";
  42. GUI.style = "float:right;width:100%;background-color: rgba(0,0,0,0.25);border-radius:5%;text-align:center;margin-top:5%;";
  43.  
  44. function guiReload() {
  45. GUI.innerHTML = "";
  46. if(unsafeWindow.getHack("GUI").status) {
  47. GUI.innerHTML += "<br><h2 style='color:#A882DC;'>YT: ZaresPlus X</h2><hr>";
  48. unsafeWindow.hacks.forEach(function(hack) {
  49. GUI.innerHTML += `<h3><span style='float:left;margin-left:10%;color:#FFBD48'>[${hack.keybind}]</span><span style='margin-left:-10%;color:${hack.status ? "#98EA2F" : "#FF4040"};'>${hack.name}</span></h3>`;
  50. });
  51. GUI.innerHTML += "<br>";
  52. }
  53. }
  54.  
  55. setInterval(function(){
  56. let topRight = document.getElementById("topRight");
  57. if(!topRight) return;
  58.  
  59. if(!topRight.contains(GUI)) {
  60. topRight.appendChild(GUI);
  61. } else {
  62. guiReload();
  63. }
  64. }, 0);
  65.  
  66. function patch(script) {
  67. script = script.replace(/(\!)/,
  68. `
  69. var inputs;
  70. var control;
  71. var myself;
  72. var players;
  73.  
  74. var cS = true;
  75. var sO = false;
  76. function quickscoper(target) {
  77. if (myself.didShoot) {
  78. cS = false;
  79. setTimeout(() => {
  80. cS = true;
  81. }, myself.weapon.rate);
  82. }
  83. if (control.mouseDownL === 1) {
  84. control.mouseDownL = 0;
  85. control.mouseDownR = 0;
  86. sO = true;
  87. }
  88. if (myself.aimVal === 1) {
  89. sO = false;
  90. }
  91. if (sO || !cS || myself.recoilForce > 0.01) {
  92. return false;
  93. }
  94. lA(target);
  95. if (control.mouseDownR === 0) {
  96. control.mouseDownR = 1;
  97. }
  98. else if (myself.aimVal < 0.2) {
  99. control.mouseDownL = 1 - control.mouseDownL;
  100. }
  101. return true;
  102. }
  103. function lA(target) {
  104. control.camLookAt(target.x2, target.y2 + target.height - 1.5 - 2.5 * target.crouchVal - myself.recoilAnimY * 0.3 * 25, target.z2);
  105. }
  106. function dist(p1, p2) {
  107. const dx = p1.x - p2.x;
  108. const dy = p1.y - p2.y;
  109. const dz = p1.z - p2.z;
  110. return Math.sqrt(dx * dx + dy * dy + dz * dz);
  111. }
  112. $1`
  113. );
  114. script = script.replace(/(this\[\'procInputs\'\]=function\((\w+),(\w+),(\w+),\w+\)\{)/,
  115. `$1
  116. inputs = $2;
  117.  
  118. /* Aimbot */
  119. if(getHack("Aimbot").status) {
  120. if (!myself || players.length < 1) {
  121. return;
  122. }
  123.  
  124. const possibleTargets = players.filter(player => {
  125. return player.active && player.isSeen && !player.isYou && (!player.team || player.team !== myself.team);
  126. }).sort((p1, p2) => dist(myself, p1) - dist(myself, p2));
  127.  
  128. let isLockedOn = false;
  129. if (possibleTargets.length > 0) {
  130. const target = possibleTargets[0];
  131. isLockedOn = quickscoper(target);
  132. }
  133. if(!isLockedOn) {
  134. control.camLookAt(null);
  135. control.target = null;
  136. control.mouseDownL = 0;
  137. control.mouseDownR = 0;
  138. }
  139. }
  140.  
  141. /* BHop */
  142. if(control['keys'][control['moveKeys'][0]] && getHack("BHop").status) {
  143. control['keys'][control['jumpKey']] = !control['keys'][control['jumpKey']];
  144. }
  145.  
  146. /* AutoReload */
  147. if(myself && myself.ammos[myself.weaponIndex] === 0 && getHack("AutoReload").status) {
  148. inputs[9] = 1;
  149. }
  150. `
  151. );
  152. script = script.replace(/(this\[\'update\'\]\=function\(\w+\,\w+\,(\w+)\)\{)/,
  153. `$1
  154. players = this.players.list;
  155. myself = $2;
  156. `
  157. );
  158. script = script.replace(/(this\[\'setCamPosOff\'\]\=)/,
  159. `
  160. control = this
  161. ,$1`
  162. );
  163. script = script.replace(/{if\(this\['target']\){([^}]+)}},this\['([a-zA-Z0-9_]+)']=/, `
  164. {
  165. if (this.target) {
  166. this.yDr = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, this.target.xD)) % Math.PI2;
  167. this.xDr = this.target.yD % Math.PI2;
  168. }
  169. }, this.camLookAt =
  170. `);
  171. script = script.replace(/(\w+)\[\'\w+\'\](\(\w+\[\'x\'\]\,\w+\[\'y\'\]\+\w+\[\'height\'\]\/1.5\,\w+\[\'z\'\])/, `$1['camLookAt']$2`);
  172. script = script.replace(/if\(!\w+\['isSeen'\]\)continue;/, `if(!getHack("ESP").status)continue;`);
  173. script = script.replace(/(\(((\w+))=this\['map']\['manager']\['objects']\[(\w+)]\))(.+?)\)/, '$1.penetrable&&$2.active)');
  174.  
  175. return script;
  176. }
  177.  
  178. (function(){
  179. var hideHook = function(fn, oFn) { fn.toString = oFn.toString.bind(oFn); }
  180.  
  181. const handler = {
  182. construct(target, args) {
  183. if (args[1].length > 840000) {
  184. args[1] = patch(args[1]);
  185. }
  186. return new target(...args);
  187. }
  188. };
  189.  
  190. var original_Function = unsafeWindow.Function;
  191. unsafeWindow.Function = new Proxy(Function, handler);
  192. hideHook(unsafeWindow.Function, original_Function);
  193. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement