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 yet (working on it).

Från och med 2022-09-14. Se den senaste versionen.

  1. // ==UserScript==
  2. // @name Gats.io right click for spacebar
  3. // @version 2.0.5.3
  4. // @description This script allows you to use your right click for the abilities you usually use with spacebar. However it wont work for shield yet (working on it).
  5. // @author Rayan223
  6. // @match https://gats.io/
  7. // @icon none
  8. // @grant none
  9. // @license MIT
  10. // @namespace https://greasyfork.org/users/825882
  11. // ==/UserScript==
  12.  
  13. var rightClick = 0;
  14. var unRightClick = 0
  15.  
  16. var loaded = 0;
  17. window.addEventListener('load', function () {
  18. loaded = 1;
  19. })
  20.  
  21. document.body.onmousedown = function(e) {
  22. if (e.button == 2) {
  23. ++rightClick;
  24. click();
  25. console.log("clic");
  26. }
  27. }
  28.  
  29. document.body.onmouseup = function(e) {
  30. if (e.button == 2) {
  31. --rightClick;
  32. ++unRightClick;
  33. click();
  34. console.log("unclic");
  35. }
  36. }
  37.  
  38. function click() {
  39. if(loaded == 0){
  40. return
  41. }
  42. if(rightClick == 1){
  43. RF.list[0].socket.send('k,5,1');
  44. }
  45. if (unRightClick == 1){
  46. RF.list[0].socket.send('k,5,0');
  47. --unRightClick;
  48. }
  49. }
  50. //window.oncontextmenu = function ()
  51. //{
  52. // dash();
  53. // setTimeout(afterdash,50);
  54. // return false;
  55. //}
  56.  
  57. //function dash(){
  58. // RF.list[0].socket.send('k,5,1');
  59. //}
  60.  
  61. //function afterdash(){
  62. // RF.list[0].socket.send('k,5,0');
  63. //}