Gats.io right click for spacebar

This script allows you to use your right click for the abilities you usually use with spacebar. However it wont work for shield (working on it).

Från och med 2021-10-23. Se den senaste versionen.

// ==UserScript==
// @name         Gats.io right click for spacebar
// @version      2.2.13
// @description  This script allows you to use your right click for the abilities you usually use with spacebar. However it wont work for shield (working on it).
// @author       Rayan223
// @match        https://gats.io/
// @icon         none
// @grant        none
// @namespace https://greasyfork.org/users/825882
// ==/UserScript==

var numberdash = 0;
var shieldmode = 0;
let infinite = 9999999999999999;
var ondash;

window.oncontextmenu = function ()
{
    dash();
    ++numberdash
    
    
    if (numberdash>1){
        if(ondash){
        clearTimeout(ondash);
        ondash = null;
        }
        ondash = setTimeout(afterdash,infinite);
        shieldmode = 1;
    }else{
        clearTimeout(ondash);
        numberdash =0;
        shieldmode = 0;
    }
}

document.body.onclick = function (e) {
    var isRightMB;
    e = e || window.event;

    if ("which" in e)  // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
        isRightMB = e.which == 3; 
    else if ("button" in e)  // IE, Opera 
        isRightMB = e.button == 2; 

    alert("Right mouse button " + (isRightMB ? "" : " was not") + "clicked!");
}

window.onclick = function(){
    numberdash = 0;
    clearTimeout(ondash);
}

function dash(){
    RF.list[0].socket.send('k,5,1');
}

function afterdash(){
    RF.list[0].socket.send('k,5,0');
    shieldmode = 0;
}