Random aimer

It usually roughing, but when clicking a mouse, it backs to normal aiming.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Random aimer
// @namespace    http://tampermonkey.net/
// @version      0.1.5.3
// @description  It usually roughing, but when clicking a mouse, it backs to normal aiming.
// @author       You
// @match        diep.io/
// @grant        none
// ==/UserScript==

var mouseX, mouseY, autoSpin, moving = false, wasMoving = false;

function randMove(){
  i = (Math.random() * 360) * Math.PI / 180;
  canvas.dispatchEvent(new MouseEvent("mousemove", {
    clientX : canvas.width / 2 + Math.sin( i ) * 100,
    clientY : canvas.height / 2 + Math.cos( i ) * 100
  }));
}

window.addEventListener("keydown",function(event) {
  switch (event.key) {
    case "x":
      clearInterval( autoSpin );
      moving = false; wasMoving = false;
      canvas.dispatchEvent(new MouseEvent("mousemove", { clientX : event.clientX, clientY : event.clientY }));
    break;
      case "z":
      clearInterval( autoSpin );
      moving = true; wasMoving = true;
      autoSpin = setInterval( randMove ,10 );
      break;
  }
});

document.addEventListener("mousedown", function(event) {
  if (moving) {wasMoving = true; moving = false; clearInterval( autoSpin );
  canvas.dispatchEvent(new MouseEvent("mousemove", { clientX : event.clientX, clientY : event.clientY }));
  }
});

document.addEventListener("mouseup", function(event) {
  if (wasMoving) {autoSpin = setInterval( randMove ,12 ); moving = true; wasMoving = false;}
});

document.addEventListener("mousemove", function(event) {
  if (moving) randMove();
});