Advertisement
Guest User

bruh.io aimbot script

a guest
Jun 3rd, 2019
1,858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.61 KB | None | 0 0
  1. How to use the script?
  2. 1. Open up developer tools
  3. 2. Go to console
  4. 3. Paste the script into the console and press enter (NOTE YOU HAVE TO BE IN THE GAME WHEN YOU'RE DONE LOADING INTO A SERVER)
  5. Controls
  6. Shift - 8x scope
  7. Ctrl - Even bigger scope
  8. Space (you can hold space or not, it's up to you) - Assisted aim
  9. 5 - Laser dot
  10. V - Walk to nearby items
  11.  
  12. //game.predictor.weaponSystem.currentWeapon.cooldown
  13. game.simulator.id++;
  14. console.clear();
  15.  
  16. var centerX = window.innerWidth / 2;
  17. var centerY = window.innerHeight / 2;
  18. var img = [ [ "https://i.imgur.com/gqvL4kz.png", "aimHealth" ] ];
  19. for ( var i in img )
  20. {
  21. window[ "image" + i ] = new Image();
  22. window[ "image" + i ].src = img[ i ];
  23. window[ "image" + i ].style.position = "absolute";
  24. window[ "image" + i ].style.display = "inline-block";
  25. window[ "image" + i ].id = img[ i ][ 1 ];
  26. window[ "image" + i ].style.width = "30px";
  27. window[ "image" + i ].style.marginLeft = "-15px";
  28. window[ "image" + i ].style.marginTop = "-15px";
  29. window[ "image" + i ].style.left = centerX + 'px';
  30. window[ "image" + i ].style.top = centerY + 'px';
  31. window[ "image" + i ].style.zIndex = Infinity;
  32. document.body.appendChild( window[ "image" + i ] );
  33. }
  34. function TouchKey ( c, k )
  35. {
  36. var e = new Event( "keydown" );
  37. e.key = c;
  38. e.keyCode = k;
  39. e.which = e.keyCode;
  40. e.altKey = false;
  41. e.ctrlKey = true;
  42. e.shiftKey = false;
  43. e.metaKey = false;
  44. e.bubbles = true;
  45. document.dispatchEvent( e );
  46. var f = new Event( "keyup" );
  47. f.key = c;
  48. f.keyCode = k;
  49. f.which = e.keyCode;
  50. f.altKey = false;
  51. f.ctrlKey = true;
  52. f.shiftKey = false;
  53. f.metaKey = false;
  54. f.bubbles = true;
  55. document.dispatchEvent( f );
  56. } // drop( 'e', 69 );
  57. function KeyUp ( c, k )
  58. {
  59. var e = new Event( "keyup" );
  60. e.key = c;
  61. e.keyCode = k;
  62. e.which = e.keyCode;
  63. e.altKey = false;
  64. e.ctrlKey = true;
  65. e.shiftKey = false;
  66. e.metaKey = false;
  67. e.bubbles = true;
  68. document.dispatchEvent( e );
  69. }
  70. function KeyDown ( c, k )
  71. {
  72. var e = new Event( "keydown" );
  73. e.key = c;
  74. e.keyCode = k;
  75. e.which = e.keyCode;
  76. e.altKey = false;
  77. e.ctrlKey = true;
  78. e.shiftKey = false;
  79. e.metaKey = false;
  80. e.bubbles = true;
  81. document.dispatchEvent( e );
  82. }
  83. function GetDistance ( x, y, x2, y2 )
  84. {
  85. return d = Math.sqrt( Math.pow( x - x2, 2 ) + Math.pow( y - y2, 2 ) );
  86. }
  87. function FindShootablePlayer ()
  88. {
  89. var cid = undefined;
  90. var CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState.mx, game.input.currentState.my );
  91. var d = Infinity;
  92. var MouseX = CoordinatesTranslation[ "x" ];
  93. var MouseY = CoordinatesTranslation[ "y" ];
  94. var Myself = game.renderer.myEntity;
  95. var player = undefined;
  96. var PlayerIdsArray = [];
  97. var Raydistance = undefined;
  98. var RayToPlayer = undefined;
  99. var ToPlayerDistance = Infinity;
  100. var ToPlayerDistance = undefined;
  101. //Retreive all players
  102. for ( var key of game.simulator.entities.keys() )
  103. {
  104. if ( game.simulator.entities.get( key ).id != Myself.id && game.simulator.entities.get( key ).isPlayer == true && game.simulator.entities.get( key ).isGhost == false )
  105. {
  106. PlayerIdsArray.push( game.simulator.entities.get( key ).id );
  107. }
  108. }
  109. if ( PlayerIdsArray.length == 0 )
  110. {
  111. TargetPlayer = undefined;
  112. return
  113. }
  114. //Remove non shootable players
  115. for ( let index = 0; index < PlayerIdsArray.length; index++ )
  116. {
  117. player = game.simulator.entities.get( PlayerIdsArray[ index ] );
  118. RayToPlayer = game.simulator.collisionSystem.computeRay(
  119. {
  120. x: Myself.x
  121. , y: Myself.y
  122. }, Math.atan2( player.y - Myself.y, player.x - Myself.x ), game.predictor.weaponSystem.currentWeapon.bulletTravelDistance );
  123. Raydistance = GetDistance( RayToPlayer.endX, RayToPlayer.endY, RayToPlayer.startX, RayToPlayer.startY );
  124. ToPlayerDistance = GetDistance( Myself.x, Myself.y, player.x, player.y );
  125. if ( Raydistance < ToPlayerDistance )
  126. {
  127. PlayerIdsArray.splice( index, 1 );
  128. }
  129. }
  130. //Get closest player
  131. for ( let index = 0; index < PlayerIdsArray.length; index++ )
  132. {
  133. player = game.simulator.entities.get( PlayerIdsArray[ index ] );
  134. ToPlayerDistance = GetDistance( MouseX, MouseY, player.x, player.y );
  135.  
  136. if ( d > ToPlayerDistance )
  137. {
  138. d = ToPlayerDistance;
  139. cid = PlayerIdsArray[ index ];
  140. }
  141. }
  142. //asign TargetPlayer
  143. TargetPlayer = game.simulator.entities.get( cid );
  144. return
  145. }
  146.  
  147. var Interval_Aimbot = 0;
  148. var Interval_FollowTarget = 0;
  149. var Interval_WalkToHealth = 0;
  150. var KeyMap = {};
  151. var Myself = 0;
  152. var TargetPlayer = undefined;
  153. var Toggle_Aimbot = false;
  154. var Toggle_FollowTarget = false;
  155. var Toggle_WalkToHealth = false;
  156. var LastuserX = 0;
  157. var LastuserY = 0;
  158.  
  159. setInterval( FindShootablePlayer, 10 );
  160.  
  161. onkeydown = onkeyup = function ( e )
  162. {
  163. e = e || event;
  164. KeyMap[ e.keyCode ] = e.type == 'keydown';
  165. //if ( ( e.keyCode == 32 ) && ( e.type == "keydown" ))
  166. //-----------------------------------------------------
  167. if ( e.keyCode == 82 && e.type == "keyup" )
  168. {
  169. MyReload();
  170. }
  171.  
  172.  
  173. if ( e.keyCode == 53 )
  174. {
  175. game.renderer.myEntity.addLaserSight();
  176. }
  177.  
  178.  
  179. if ( e.keyCode == 17 )
  180. {
  181. game.renderer.setZoomLevel( 1 );
  182. }
  183.  
  184.  
  185. if ( e.keyCode == 16 )
  186. {
  187. game.renderer.setZoomLevel( 2 );
  188. }
  189.  
  190.  
  191. if ( ( e.keyCode == 32 ) && ( e.type == "keydown" ) && ( Toggle_Aimbot == false ) )
  192. {
  193. Toggle_Aimbot = true;
  194. Interval_Aimbot = setInterval( Aimbot, 5 );
  195. }
  196. if ( ( e.keyCode == 32 ) && ( e.type == "keyup" ) && ( Toggle_Aimbot == true ) )
  197. {
  198. Toggle_Aimbot = false;
  199. clearInterval( Interval_Aimbot );
  200. Interval_Aimbot = 0;
  201. game.input.currentState.mouseDown = false;
  202. }
  203.  
  204.  
  205. if ( ( e.keyCode == 86 ) && ( e.type == "keydown" ) && ( Toggle_WalkToHealth ==
  206. false ) )
  207. {
  208. for ( var i in img )
  209. {
  210. window[ "image" + i ].style.display = "inline-block";
  211. }
  212. Toggle_WalkToHealth = true;
  213. Interval_WalkToHealth = setInterval( PickupHealth, 5 );
  214. }
  215. if ( ( e.keyCode == 86 ) && ( e.type == "keyup" ) && ( Toggle_WalkToHealth == true ) )
  216. {
  217. for ( var i in img )
  218. {
  219. window[ "image" + i ].style.display = "none";
  220. }
  221. Toggle_WalkToHealth = false;
  222. clearInterval( Interval_WalkToHealth );
  223. Interval_WalkToHealth = 0;
  224. game.input.currentState.a = false;
  225. game.input.currentState.d = false;
  226. game.input.currentState.s = false;
  227. game.input.currentState.w = false;
  228. }
  229. }
  230.  
  231. function Aimbot ()
  232. {
  233. game.predictor.weaponSystem.currentWeapon.kickAmount = 0;
  234. game.predictor.weaponSystem.currentWeapon.recoilAccumulator = 0;
  235. game.predictor.weaponSystem.currentWeapon.recoilMax = 0;
  236. game.predictor.weaponSystem.currentWeapon.recoilStrength = 0;
  237. //Initialize variables
  238. var Myself = game.renderer.myEntity;
  239. var MyTargetVar = game.renderer.entities.get( TargetPlayer.id );
  240. var RayToPlayer = undefined;
  241. var Raydistance = undefined;
  242. var ToPlayerDistance = undefined;
  243. //Reload if needed
  244. if ( game.predictor.weaponSystem.currentWeapon.currentAmmo == 0 && game.predictor
  245. .weaponSystem.currentWeapon.isReloading == false )
  246. {
  247. MyReload();
  248. }
  249. //Heal if needed
  250. if ( Myself.hasBandages == true && Myself._hp < 70 )
  251. {
  252. game.input.currentState.one = true;
  253. setTimeout( function ()
  254. {
  255. game.input.currentState.one = false;
  256. }, 20 );
  257. }
  258. if ( Myself.hasPainkillers == true && Myself._hp < 69 )
  259. {
  260. game.input.currentState.two = true;
  261. setTimeout( function ()
  262. {
  263. game.input.currentState.two = false;
  264. }, 20 );
  265. }
  266. if ( Myself.hasMedpack == true && Myself._hp < 50 )
  267. {
  268. game.input.currentState.three = true;
  269. setTimeout( function ()
  270. {
  271. game.input.currentState.three = false;
  272. }, 20 );
  273. }
  274. //Exit if no target acquired
  275. if ( MyTargetVar == undefined )
  276. {
  277. return
  278. }
  279. //ConfirmShot
  280. RayToPlayer = game.simulator.collisionSystem.computeRay(
  281. {
  282. x: Myself.x
  283. , y: Myself.y
  284. }, Math.atan2( MyTargetVar.y - Myself.y, MyTargetVar.x - Myself.x ), game.predictor.weaponSystem.currentWeapon.bulletTravelDistance );
  285. Raydistance = GetDistance( RayToPlayer.endX, RayToPlayer.endY, RayToPlayer.startX, RayToPlayer.startY );
  286. ToPlayerDistance = GetDistance( Myself.x, Myself.y, MyTargetVar.x, MyTargetVar.y );
  287.  
  288. if ( Raydistance > ToPlayerDistance )
  289. {
  290. AimToPos( MyTargetVar.x, MyTargetVar.y );
  291. game.input.frameState.mouseDown = true;
  292. }
  293. else
  294. {
  295. return
  296. }
  297. return
  298. }
  299.  
  300. function AimToPos ( _x, _y )
  301. {
  302. var CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  303. .mx, game.input.currentState.my );
  304. //-----------------------------------------------------------
  305. if ( CoordinatesTranslation[ "x" ] + 20 < _x )
  306. {
  307. game.input.currentState.mx += 20
  308. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  309. .mx, game.input.currentState.my );
  310. }
  311. if ( CoordinatesTranslation[ "y" ] + 20 < _y )
  312. {
  313. game.input.currentState.my += 20
  314. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  315. .mx, game.input.currentState.my );
  316. }
  317. if ( CoordinatesTranslation[ "x" ] - 20 > _x )
  318. {
  319. game.input.currentState.mx -= 20
  320. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  321. .mx, game.input.currentState.my );
  322. }
  323. if ( CoordinatesTranslation[ "y" ] - 20 > _y )
  324. {
  325. game.input.currentState.my -= 20
  326. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  327. .mx, game.input.currentState.my );
  328. }
  329. //-----------------------------------------------------------
  330. if ( CoordinatesTranslation[ "x" ] + 5 < _x )
  331. {
  332. game.input.currentState.mx += 5
  333. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  334. .mx, game.input.currentState.my );
  335. }
  336. if ( CoordinatesTranslation[ "y" ] + 5 < _y )
  337. {
  338. game.input.currentState.my += 5
  339. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  340. .mx, game.input.currentState.my );
  341. }
  342. if ( CoordinatesTranslation[ "x" ] - 5 > _x )
  343. {
  344. game.input.currentState.mx -= 5
  345. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  346. .mx, game.input.currentState.my );
  347. }
  348. if ( CoordinatesTranslation[ "y" ] - 5 > _y )
  349. {
  350. game.input.currentState.my -= 5
  351. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  352. .mx, game.input.currentState.my );
  353. }
  354. //-----------------------------------------------------------
  355. if ( CoordinatesTranslation[ "x" ] < _x )
  356. {
  357. game.input.currentState.mx += 1
  358. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  359. .mx, game.input.currentState.my );
  360. }
  361. if ( CoordinatesTranslation[ "y" ] < _y )
  362. {
  363. game.input.currentState.my += 1
  364. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  365. .mx, game.input.currentState.my );
  366. }
  367. if ( CoordinatesTranslation[ "x" ] > _x )
  368. {
  369. game.input.currentState.mx -= 1
  370. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  371. .mx, game.input.currentState.my );
  372. }
  373. if ( CoordinatesTranslation[ "y" ] > _y )
  374. {
  375. game.input.currentState.my -= 1
  376. CoordinatesTranslation = game.renderer.toWorldCoordinates( game.input.currentState
  377. .mx, game.input.currentState.my );
  378. }
  379. }
  380.  
  381. function MyReload ()
  382. {
  383. var activeStart = game.predictor.weaponSystem.currentWeapon.activeStart;
  384. var reloadDuration = game.predictor.weaponSystem.currentWeapon.reloadDuration;
  385. var progressCb = ( activeStart * reloadDuration * 1000 ) + 5;
  386. var Accumulator = game.predictor.weaponSystem.currentWeapon.reloadAccumulator;
  387.  
  388. if ( game.predictor.weaponSystem.currentWeapon.isReloading == false )
  389. {
  390. TouchKey( 'r', 82 );
  391. }
  392.  
  393. setTimeout( () =>
  394. {
  395. TouchKey( 'r', 82 );
  396. }, progressCb );
  397. }
  398. function PickupHealth ()
  399. {
  400. // 10 - MedPack
  401. // 11 - Bandages
  402. // 12 - PainKillers
  403. //
  404. function isInsideRect ( x, y )
  405. {
  406. var poisonx1 = game.simulator.poison.currX;
  407. var poisony1 = game.simulator.poison.currY;
  408. var poisonx2 = game.simulator.poison.currX + game.simulator.poison.currWidth;
  409. var poisony2 = game.simulator.poison.currY + game.simulator.poison.currWidth;
  410.  
  411. if ( ( x >= poisonx1 ) && ( x <= poisonx2 ) &&
  412. ( y >= poisony1 ) && ( y <= poisony2 ) )
  413. {
  414. return true;
  415. }
  416. else
  417. {
  418. return false;
  419. }
  420. }
  421. var BruhMapDump = game.simulator.entities.entries( "entries" );
  422. var Myself = game.renderer.myEntity;
  423. var HealthItems = [];
  424. //get all health items from visible map
  425. for ( var [ key, value ] of BruhMapDump )
  426. {
  427. var isInArea = isInsideRect( value[ "x" ], value[ "y" ] );
  428. if ( Myself.hasMedpack != true && value[ "weaponType" ] == 10 && isInArea == true )
  429. {
  430. HealthItems.push( value[ "id" ] );
  431. }
  432. if ( Myself.hasBandages != true && value[ "weaponType" ] == 11 && isInArea == true )
  433. {
  434. HealthItems.push( value[ "id" ] );
  435. }
  436. if ( Myself.hasPainkillers != true && value[ "weaponType" ] == 12 && isInArea == true )
  437. {
  438. HealthItems.push( value[ "id" ] );
  439. }
  440. if ( Myself.shields < 45 && value[ "weaponType" ] == 16 && isInArea == true )
  441. {
  442. HealthItems.push( value[ "id" ] );
  443. }
  444. }
  445.  
  446. //Get closest item
  447. var item = 0;
  448. var ToItemDistance = 0;
  449. var d = Infinity;
  450. var cid = Infinity;
  451. for ( let index = 0; index < HealthItems.length; index++ )
  452. {
  453. item = game.simulator.entities.get( HealthItems[ index ] );
  454. ToItemDistance = GetDistance( Myself.x, Myself.y, item.x, item.y );
  455.  
  456. if ( d > ToItemDistance )
  457. {
  458. d = ToItemDistance;
  459. cid = HealthItems[ index ];
  460. }
  461. }
  462. //asign item
  463. item = game.simulator.entities.get( cid );
  464. //Align image
  465. var img_finder_x = 0;
  466. var img_finder_y = 0;
  467. var img_translation_coordinates = game.renderer.toWorldCoordinates(
  468. img_finder_x, img_finder_y );
  469. while ( img_translation_coordinates[ "x" ] < item.x )
  470. {
  471. img_finder_x++;
  472. img_translation_coordinates = game.renderer.toWorldCoordinates( img_finder_x
  473. , img_finder_y );
  474. }
  475. while ( img_translation_coordinates[ "y" ] < item.y )
  476. {
  477. img_finder_y++;
  478. img_translation_coordinates = game.renderer.toWorldCoordinates( img_finder_x
  479. , img_finder_y );
  480. }
  481. for ( var i in img )
  482. {
  483. window[ "image" + i ].style.left = img_finder_x + 'px';
  484. window[ "image" + i ].style.top = img_finder_y + 'px';
  485. }
  486. //Move Accordingly
  487. if ( Myself.x > item.x - 2.22 )
  488. {
  489. if ( game.input.currentState.d == true )
  490. {
  491. game.input.currentState.d = false;
  492. }
  493. if ( game.input.currentState.a == false )
  494. {
  495. game.input.currentState.a = true;
  496. }
  497. }
  498. if ( Myself.x < item.x + 2.22 )
  499. {
  500. if ( game.input.currentState.a == true )
  501. {
  502. game.input.currentState.a = false;
  503. }
  504. if ( game.input.currentState.d == false )
  505. {
  506. game.input.currentState.d = true;
  507. }
  508. }
  509. if ( Myself.y < item.y + 2.22 )
  510. {
  511. if ( game.input.currentState.w == true )
  512. {
  513. game.input.currentState.w = false;
  514. }
  515. if ( game.input.currentState.s == false )
  516. {
  517. game.input.currentState.s = true;
  518. }
  519. }
  520. if ( Myself.y > item.y - 2.22 )
  521. {
  522. if ( game.input.currentState.s == true )
  523. {
  524. game.input.currentState.s = false;
  525. }
  526. if ( game.input.currentState.w == false )
  527. {
  528. game.input.currentState.w = true;
  529. }
  530. }
  531. if ( Myself.y > item.y - 2.22 && Myself.y < item.y + 2.22 )
  532. {
  533. if ( game.input.currentState.s == true )
  534. {
  535. game.input.currentState.s = false;
  536. }
  537. if ( game.input.currentState.w == true )
  538. {
  539. game.input.currentState.w = false;
  540. }
  541. }
  542. if ( Myself.x > item.x - 2.22 && Myself.x < item.x + 2.22 )
  543. {
  544. if ( game.input.currentState.a == true )
  545. {
  546. game.input.currentState.a = false;
  547. }
  548. if ( game.input.currentState.d == true )
  549. {
  550. game.input.currentState.d = false;
  551. }
  552. }
  553. if ( d < 2.5 )
  554. {
  555. TouchKey( 'e', 69 );
  556. }
  557. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement