Kill counter

kill thingy

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Kill counter
// @namespace    http://tampermonkey.net/
// @version      3
// @description  kill thingy
// @author       MI300#4401
// @match        https://diep.io/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license      MIT
// @grant        none
// ==/UserScript==
function hook(target, callback){
  const check = () => {
    window.requestAnimationFrame(check)
    const func = CanvasRenderingContext2D.prototype[target]

    if(func.toString().includes(target)){

      CanvasRenderingContext2D.prototype[target] = new Proxy (func, {
        apply (method, thisArg, args) {
          callback(thisArg, args)

          return Reflect.apply (method, thisArg, args)
        }
      });
    }
  }
  check()
}
let blacklist = new Array (0);
let killCounter = 0;
hook('fillText', function(thisArg, args){
    if (args[0].includes("You've killed ")) {
      if (blacklist.indexOf(args[0]) === -1) {
        killCounter+=1;
        blacklist.push (args[0])
        setTimeout (function() {
          blacklist.splice(blacklist.indexOf(args[0]), 1);
        },1000);

        setTimeout (function() {
          blacklist.push(args[0]);
        },4600);

        setTimeout (function() {
          blacklist.splice(blacklist.indexOf(args[0]), 1);
        },5000);
      }
    }
})
const canvas = document.getElementById('canvas')
const ctx = canvas.getContext('2d');
setInterval(() => {
  let gui = () => {
    ctx.fillStyle = "white";
    ctx.lineWidth = 7;
    ctx.font = 3 + "em Ubuntu";
    ctx.strokeStyle = "black";
    ctx.strokeText(`Kills: ` + killCounter, canvas.width * 0.9, canvas.height * 0.7);
    ctx.fillText(`Kills: ` + killCounter, canvas.width * 0.9, canvas.height * 0.7);
    window.requestAnimationFrame(gui);
  }
  gui();
}, 1000);