Advertisement
Guest User

Untitled

a guest
Jan 29th, 2024
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.57 KB | None | 0 0
  1. // ==UserScript==
  2. // @name 1v1.LOL Aimbot, ESP & Wireframe View
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Let's you see players behind walls. Comes with a wireframe view mode and an aimbot too. Press M, N and T to toggle them.
  6. // @author Zertalious (Zert)
  7. // @match *://1v1.lol/*
  8. // @match *://1v1.school/*
  9. // @icon https://www.google.com/s2/favicons?domain=1v1.lol
  10. // @grant none
  11. // @run-at document-start
  12. // @antifeature ads
  13. // @require https://cdn.jsdelivr.net/npm/lil-gui@0.19
  14. // @downloadURL https://update.greasyfork.org/scripts/440267/1v1LOL%20Aimbot%2C%20ESP%20%20Wireframe%20View.user.js
  15. // @updateURL https://update.greasyfork.org/scripts/440267/1v1LOL%20Aimbot%2C%20ESP%20%20Wireframe%20View.meta.js
  16. // ==/UserScript==
  17.  
  18. const isSchoolLink = window.location.hostname.indexOf( '1v1.school' ) > - 1;
  19.  
  20. const searchSize = 300;
  21. const threshold = 4.5;
  22.  
  23. const settings = {
  24. aimbot: false,
  25. aimbotSpeed: 0.15,
  26. esp: true,
  27. wireframe: true,
  28. createdBy: 'Zertalious',
  29. showHelp() {
  30.  
  31. dialogEl.style.display = dialogEl.style.display === '' ? 'none' : '';
  32.  
  33. }
  34. };
  35.  
  36. let gui;
  37.  
  38. function initGui() {
  39.  
  40. gui = new lil.GUI();
  41.  
  42. const controllers = {};
  43. for ( const key in settings ) {
  44.  
  45. controllers[ key ] = gui.add( settings, key ).name( fromCamel( key ) ).listen();
  46.  
  47. }
  48. controllers.aimbotSpeed.min( 0.05 ).max( 0.5 ).step( 0.01 );
  49. controllers.createdBy.disable();
  50.  
  51. }
  52.  
  53. function fromCamel( text ) {
  54.  
  55. const result = text.replace( /([A-Z])/g, ' $1' );
  56. return result.charAt( 0 ).toUpperCase() + result.slice( 1 );
  57.  
  58. }
  59.  
  60. const WebGL = WebGL2RenderingContext.prototype;
  61.  
  62. HTMLCanvasElement.prototype.getContext = new Proxy( HTMLCanvasElement.prototype.getContext, {
  63. apply( target, thisArgs, args ) {
  64.  
  65. if ( args[ 1 ] ) {
  66.  
  67. args[ 1 ].preserveDrawingBuffer = true;
  68.  
  69. }
  70.  
  71. return Reflect.apply( ...arguments );
  72.  
  73. }
  74. } );
  75.  
  76. WebGL.shaderSource = new Proxy( WebGL.shaderSource, {
  77. apply( target, thisArgs, args ) {
  78.  
  79. let [ shader, src ] = args;
  80.  
  81. if ( src.indexOf( 'gl_Position' ) > - 1 ) {
  82.  
  83. if ( src.indexOf( 'OutlineEnabled' ) > - 1 ) {
  84.  
  85. shader.isPlayerShader = true;
  86.  
  87. }
  88.  
  89. src = src.replace( 'void main', `
  90.  
  91. out float vDepth;
  92. uniform bool enabled;
  93. uniform float threshold;
  94.  
  95. void main
  96.  
  97. ` ).replace( /return;/, `
  98.  
  99. vDepth = gl_Position.z;
  100.  
  101. if ( enabled && vDepth > threshold ) {
  102.  
  103. gl_Position.z = 1.0;
  104.  
  105. }
  106.  
  107. ` );
  108.  
  109. } else if ( src.indexOf( 'SV_Target0' ) > - 1 ) {
  110.  
  111. src = src.replace( 'void main', `
  112.  
  113. in float vDepth;
  114. uniform bool enabled;
  115. uniform float threshold;
  116.  
  117. void main
  118.  
  119. ` ).replace( /return;/, `
  120.  
  121. if ( enabled && vDepth > threshold ) {
  122.  
  123. SV_Target0 = vec4( 1.0, 0.0, 0.0, 1.0 );
  124.  
  125. }
  126.  
  127. ` );
  128.  
  129. }
  130.  
  131. args[ 1 ] = src;
  132.  
  133. return Reflect.apply( ...arguments );
  134.  
  135. }
  136. } );
  137.  
  138. WebGL.attachShader = new Proxy( WebGL.attachShader, {
  139. apply( target, thisArgs, [ program, shader ] ) {
  140.  
  141. if ( shader.isPlayerShader ) program.isPlayerProgram = true;
  142.  
  143. return Reflect.apply( ...arguments );
  144.  
  145. }
  146. } );
  147.  
  148. WebGL.getUniformLocation = new Proxy( WebGL.getUniformLocation, {
  149. apply( target, thisArgs, [ program, name ] ) {
  150.  
  151. const result = Reflect.apply( ...arguments );
  152.  
  153. if ( result ) {
  154.  
  155. result.name = name;
  156. result.program = program;
  157.  
  158. }
  159.  
  160. return result;
  161.  
  162. }
  163. } );
  164.  
  165. WebGL.uniform4fv = new Proxy( WebGL.uniform4fv, {
  166. apply( target, thisArgs, [ uniform ] ) {
  167.  
  168. const name = uniform && uniform.name;
  169.  
  170. if ( name === 'hlslcc_mtx4x4unity_ObjectToWorld' ||
  171. name === 'hlslcc_mtx4x4unity_ObjectToWorld[0]' ) {
  172.  
  173. uniform.program.isUIProgram = true;
  174.  
  175. }
  176.  
  177. return Reflect.apply( ...arguments );
  178.  
  179. }
  180. } );
  181.  
  182. let movementX = 0, movementY = 0;
  183. let count = 0;
  184.  
  185. let gl;
  186.  
  187. const handler = {
  188. apply( target, thisArgs, args ) {
  189.  
  190. const program = thisArgs.getParameter( thisArgs.CURRENT_PROGRAM );
  191.  
  192. if ( ! program.uniforms ) {
  193.  
  194. program.uniforms = {
  195. enabled: thisArgs.getUniformLocation( program, 'enabled' ),
  196. threshold: thisArgs.getUniformLocation( program, 'threshold' )
  197. };
  198.  
  199. }
  200.  
  201. const couldBePlayer = ( isSchoolLink || program.isPlayerProgram ) && args[ 1 ] > 3000;
  202.  
  203. program.uniforms.enabled && thisArgs.uniform1i( program.uniforms.enabled, ( settings.esp || settings.aimbot ) && couldBePlayer );
  204. program.uniforms.threshold && thisArgs.uniform1f( program.uniforms.threshold, threshold );
  205.  
  206. args[ 0 ] = settings.wireframe && ! program.isUIProgram && args[ 1 ] > 6 ? thisArgs.LINES : args[ 0 ];
  207.  
  208. if ( couldBePlayer ) {
  209.  
  210. gl = thisArgs;
  211.  
  212. }
  213.  
  214. Reflect.apply( ...arguments );
  215.  
  216. }
  217. };
  218.  
  219. WebGL.drawElements = new Proxy( WebGL.drawElements, handler );
  220. WebGL.drawElementsInstanced = new Proxy( WebGL.drawElementsInstanced, handler );
  221.  
  222. window.requestAnimationFrame = new Proxy( window.requestAnimationFrame, {
  223. apply( target, thisArgs, args ) {
  224.  
  225. args[ 0 ] = new Proxy( args[ 0 ], {
  226. apply() {
  227.  
  228. update();
  229.  
  230. return Reflect.apply( ...arguments );
  231.  
  232. }
  233. } );
  234.  
  235. return Reflect.apply( ...arguments );
  236.  
  237. }
  238. } );
  239.  
  240. function update() {
  241.  
  242. const isPlaying = document.querySelector( 'canvas' ).style.cursor === 'none';
  243. rangeEl.style.display = isPlaying && settings.aimbot ? '' : 'none';
  244.  
  245. if ( settings.aimbot && gl ) {
  246.  
  247. const width = Math.min( searchSize, gl.canvas.width );
  248. const height = Math.min( searchSize, gl.canvas.height );
  249.  
  250. const pixels = new Uint8Array( width * height * 4 );
  251.  
  252. const centerX = gl.canvas.width / 2;
  253. const centerY = gl.canvas.height / 2;
  254.  
  255. const x = Math.floor( centerX - width / 2 );
  256. const y = Math.floor( centerY - height / 2 );
  257.  
  258. gl.readPixels( x, y, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels );
  259.  
  260. for ( let i = 0; i < pixels.length; i += 4 ) {
  261.  
  262. if ( pixels[ i ] === 255 && pixels[ i + 1 ] === 0 && pixels[ i + 2 ] === 0 && pixels[ i + 3 ] === 255 ) {
  263.  
  264. const idx = i / 4;
  265.  
  266. const dx = idx % width;
  267. const dy = ( idx - dx ) / width;
  268.  
  269. movementX += ( x + dx - centerX );
  270. movementY += - ( y + dy - centerY );
  271.  
  272. count ++;
  273.  
  274. }
  275.  
  276. }
  277.  
  278. }
  279.  
  280. if ( count > 0 && isPlaying ) {
  281.  
  282. const f = settings.aimbotSpeed / count;
  283.  
  284. movementX *= f;
  285. movementY *= f;
  286.  
  287. window.dispatchEvent( new MouseEvent( 'mousemove', { movementX, movementY } ) );
  288.  
  289. rangeEl.classList.add( 'range-active' );
  290.  
  291. } else {
  292.  
  293. rangeEl.classList.remove( 'range-active' );
  294.  
  295. }
  296.  
  297. movementX = 0;
  298. movementY = 0;
  299. count = 0;
  300.  
  301. gl = null;
  302.  
  303. }
  304.  
  305. const value = parseInt( new URLSearchParams( window.location.search ).get( 'showAd' ), 16 );
  306.  
  307. const shouldShowAd = false;
  308.  
  309. const el = document.createElement( 'div' );
  310.  
  311. el.innerHTML = `<style>
  312.  
  313. .dialog {
  314. position: absolute;
  315. left: 50%;
  316. top: 50%;
  317. padding: 20px;
  318. background: #1e294a;
  319. color: #fff;
  320. transform: translate(-50%, -50%);
  321. text-align: center;
  322. z-index: 999999;
  323. font-family: cursive;
  324. }
  325.  
  326. .dialog * {
  327. color: #fff;
  328. }
  329.  
  330. .close {
  331. position: absolute;
  332. right: 5px;
  333. top: 5px;
  334. width: 20px;
  335. height: 20px;
  336. opacity: 0.5;
  337. cursor: pointer;
  338. }
  339.  
  340. .close:before, .close:after {
  341. content: ' ';
  342. position: absolute;
  343. left: 50%;
  344. top: 50%;
  345. width: 100%;
  346. height: 20%;
  347. transform: translate(-50%, -50%) rotate(-45deg);
  348. background: #fff;
  349. }
  350.  
  351. .close:after {
  352. transform: translate(-50%, -50%) rotate(45deg);
  353. }
  354.  
  355. .close:hover {
  356. opacity: 1;
  357. }
  358.  
  359. .btn {
  360. cursor: pointer;
  361. padding: 0.5em;
  362. background: red;
  363. border: 3px solid rgba(0, 0, 0, 0.2);
  364. }
  365.  
  366. .btn:active {
  367. transform: scale(0.8);
  368. }
  369.  
  370. .msg {
  371. position: absolute;
  372. left: 10px;
  373. top: 10px;
  374. background: #1e294a;
  375. color: #fff;
  376. font-family: cursive;
  377. font-weight: bolder;
  378. padding: 15px;
  379. animation: msg 0.5s forwards, msg 0.5s reverse forwards 3s;
  380. z-index: 999999;
  381. pointer-events: none;
  382. }
  383.  
  384. @keyframes msg {
  385. from {
  386. transform: translate(-120%, 0);
  387. }
  388.  
  389. to {
  390. transform: none;
  391. }
  392. }
  393.  
  394. .range {
  395. position: absolute;
  396. left: 50%;
  397. top: 50%;
  398. width: ${searchSize}px;
  399. height: ${searchSize}px;
  400. max-width: 100%;
  401. max-height: 100%;
  402. border: 1px solid white;
  403. transform: translate(-50%, -50%);
  404. }
  405.  
  406. .range-active {
  407. border: 2px solid red;
  408. }
  409.  
  410. </style>
  411. <div class="dialog">${shouldShowAd ? `<big>Loading ad...</big>` : `<div class="close" onclick="this.parentNode.style.display='none';"></div>
  412. <big>1v1.LOL Aimbot, ESP & Wireframe</big>
  413. <br>
  414. <br>
  415. [T] to toggle aimbot<br>
  416. [M] to toggle ESP<br>
  417. [N] to toggle wireframe<br>
  418. [H] to show/hide help<br>
  419. [/] to show/hide control panel<br>
  420. <br>
  421. By Zertalious
  422. <br>
  423. <br>
  424. <div style="display: grid; grid-template-columns: 1fr 1fr; grid-gap: 5px;">
  425. <div class="btn" onclick="window.open('https://discord.gg/K24Zxy88VM', '_blank')">Discord</div>
  426. <div class="btn" onclick="window.open('https://www.instagram.com/zertalious/', '_blank')">Instagram</div>
  427. <div class="btn" onclick="window.open('https://twitter.com/Zertalious', '_blank')">Twitter</div>
  428. <div class="btn" onclick="window.open('https://greasyfork.org/en/users/662330-zertalious', '_blank')">More scripts</div>
  429. </div>
  430. ` }
  431. </div>
  432. <div class="msg" style="display: none;"></div>
  433. <div class="range" style="display: none;"></div>`;
  434.  
  435. const msgEl = el.querySelector( '.msg' );
  436. const dialogEl = el.querySelector( '.dialog' );
  437.  
  438. const rangeEl = el.querySelector( '.range' );
  439.  
  440. window.addEventListener( 'DOMContentLoaded', function () {
  441.  
  442. while ( el.children.length > 0 ) {
  443.  
  444. document.body.appendChild( el.children[ 0 ] );
  445.  
  446. }
  447.  
  448. initGui();
  449.  
  450. if ( shouldShowAd ) {
  451.  
  452. const url = new URL( window.location.href );
  453.  
  454. url.searchParams.set( 'showAd', Date.now().toString( 16 ) );
  455. url.searchParams.set( 'scriptVersion', GM.info.script.version );
  456.  
  457. window.location.href = 'https://zertalious.xyz?ref=' + new TextEncoder().encode( url.href ).toString();
  458.  
  459. }
  460.  
  461. } );
  462.  
  463. function toggleSetting( key ) {
  464.  
  465. settings[ key ] = ! settings[ key ];
  466. showMsg( fromCamel( key ), settings[ key ] );
  467.  
  468. }
  469.  
  470. const keyToSetting = {
  471. 'KeyM': 'esp',
  472. 'KeyN': 'wireframe',
  473. 'KeyT': 'aimbot'
  474. };
  475.  
  476. window.addEventListener( 'keyup', function ( event ) {
  477.  
  478. if ( document.activeElement && document.activeElement.value !== undefined ) return;
  479.  
  480. if ( keyToSetting[ event.code ] ) {
  481.  
  482. toggleSetting( keyToSetting[ event.code ] );
  483.  
  484. }
  485.  
  486. switch ( event.code ) {
  487.  
  488. case 'KeyH':
  489. settings.showHelp();
  490. break;
  491.  
  492. case 'Slash' :
  493. gui._hidden ? gui.show() : gui.hide();
  494. break;
  495.  
  496. }
  497.  
  498. } );
  499.  
  500. function showMsg( name, bool ) {
  501.  
  502. msgEl.innerText = name + ': ' + ( bool ? 'ON' : 'OFF' );
  503.  
  504. msgEl.style.display = 'none';
  505. void msgEl.offsetWidth;
  506. msgEl.style.display = '';
  507.  
  508. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement