E, R, and T keys

Adds E, R, and T keys to the vanilla client

  1. // ==UserScript==
  2. // @name E, R, and T keys
  3. // @version 1.0
  4. // @description Adds E, R, and T keys to the vanilla client
  5. // @author ZfsrGhS953
  6. // @match *.agar.io/*
  7. // @grant none
  8. // @run-at document-start
  9. // @namespace https://greasyfork.org/users/82122
  10. // ==/UserScript==
  11.  
  12. /************************************************
  13.  
  14. Made by @ZfsrGhS953 on GitHub
  15. Go check out his project! Its really nice :)
  16. https://github.com/ZfsrGhS953/Petridish-Ogar
  17.  
  18. ************************************************/
  19.  
  20.  
  21. setTimeout(function() {
  22. window.__WebSocket = window.WebSocket;
  23. window.fakeWebSocket = function() {
  24. return {
  25. readyState: 0
  26. };
  27. };
  28. window._WebSocket = window.WebSocket = function(ip) {
  29. return new window.fakeWebSocket(ip);
  30. };
  31. window.key = {
  32. e: false,
  33. r: false,
  34. t: false
  35. };
  36. window.addEventListener("load", function() {
  37. // код инжектинга
  38. if (!window.OldSocket)
  39. OldSocket = window.__WebSocket;
  40. window._WebSocket = window.WebSocket = window.fakeWebSocket = function(ip) {
  41. var ws = new OldSocket(ip);
  42. ws.binaryType = "arraybuffer";
  43. var fakeWS = {};
  44. for (var i in ws) {
  45. fakeWS[i] = ws[i];
  46. }
  47. fakeWS.send = function() {
  48. if (arguments[0][0] == 16) {
  49. if (window.key.e){
  50. arguments[0] = new Int8Array(1);
  51. arguments[0][0] = 22;
  52. }
  53. if (window.key.r){
  54. arguments[0] = new Int8Array(1);
  55. arguments[0][0] = 23;
  56. }
  57. if (window.key.t){
  58. arguments[0] = new Int8Array(1);
  59. arguments[0][0] = 24;
  60. }
  61. window.key.e = window.key.r = window.key.t = false;
  62. }
  63. return ws.send.apply(ws, arguments);
  64. };
  65. ws.onmessage = function() {
  66. fakeWS.onmessage && fakeWS.onmessage.apply(ws, arguments);
  67. };
  68. ws.onopen = function() {
  69. fakeWS.readyState = 1;
  70. fakeWS.onopen.apply(ws, arguments);
  71. };
  72. ws.onclose = function(){
  73. fakeWS.onclose.apply(ws, arguments);
  74. };
  75. return fakeWS;
  76. };
  77. });
  78. document.addEventListener('keydown', function(e) {
  79. var key = e.keyCode || e.which;
  80. switch (key) {
  81. case 69:
  82. window.key.e = true;
  83. break;
  84. case 82:
  85. window.key.r = true;
  86. break;
  87. case 84:
  88. window.key.t = true;
  89. break;
  90. }
  91. });
  92. }, 200);