Random aimer

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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();
});