Advertisement
Le0nmmy

Untitled

Jan 23rd, 2020
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.65 KB | None | 0 0
  1. // ==UserScript==
  2. // @name uweistlost
  3. // @namespace uweistlost
  4. // @version 1.2.1
  5. // @description uweistlost
  6. // @author le0nmky
  7. // @match *.swordz.io
  8. // @grant uweistlost
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.  
  13. })();
  14.  
  15. var aimbot = false;
  16. var tracers = true;
  17. var staying = false;
  18. var speedhack = false;
  19. var autorespawn = false;
  20. var isAimbotActive = false;
  21.  
  22. function onUpdate() {
  23. if(autorespawn && Player.list[selfId].map == "menu" && respawnButton.style.display != " ") {
  24. respawnButton.click();
  25. playButton.click();
  26. }
  27. if(Player.list[selfId].map != undefined && Player.list[selfId].map != 'menu') {
  28. if(staying) {
  29. socket.emit('keyPress', {
  30. inputId: 'mouseDistance',
  31. state: 0
  32. });
  33. }
  34. if(aimbot) {
  35. var prevPlayer = {};
  36.  
  37. var diffX;
  38. var diffY;
  39.  
  40. for(var playerId in Player.list) {
  41. if(playerId != selfId) {
  42. var otherPlayer = Player.list[playerId];
  43. if(otherPlayer.map != undefined && otherPlayer.map != "menu") {
  44. diffX = otherPlayer.x - Player.list[selfId].x;
  45. diffY = otherPlayer.y - Player.list[selfId].y;
  46. var currentDistance = Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2));
  47. if(prevPlayer.distance != undefined) {
  48. if(currentDistance <= prevPlayer.distance) {
  49. prevPlayer.player = otherPlayer;
  50. prevPlayer.distance = currentDistance;
  51. }
  52. } else {
  53. prevPlayer.player = otherPlayer;
  54. prevPlayer.distance = currentDistance;
  55. }
  56. }
  57. }
  58. }
  59.  
  60. if(isAimbotActive = (prevPlayer.distance != undefined && !isNaN(prevPlayer.distance) && prevPlayer.distance <= 500)) {
  61. diffX = prevPlayer.player.x - Player.list[selfId].x;
  62. diffY = prevPlayer.player.y - Player.list[selfId].y;
  63. mouseAngle = (Math.atan2(diffY, diffX) * 180 / Math.PI);
  64. //AutoAttack
  65. socket.emit('keyPress', {
  66. inputId: 'angle',
  67. state: speedhack ? (mouseAngle + 180) % 360 : mouseAngle
  68. });
  69. socket['emit']('keyPress', {
  70. inputId: 'leftButton',
  71. state: true
  72. });
  73. }
  74. }
  75. }
  76. }
  77.  
  78. setInterval(onUpdate, 100);
  79.  
  80. document.onmousemove = function (info) {
  81. if (info.clientX < 110 && info.clientY > window.innerHeight - 310) {
  82. return;
  83. }
  84. if (Player.list[selfId] && Player.list[selfId].map != 'menu') {
  85. var x = -canvasWIDTH / 2 + info.clientX;
  86. var y = -canvasHEIGHT / 2 + info.clientY;
  87. if(!isAimbotActive) {
  88. mouseAngle = Math.atan2(y, x) / Math.PI * 180;
  89. }
  90. mouseDistance = 1;
  91. if (getDistance(x, y, 0, 0) < canvasWIDTH * canvasWIDTH / 324) {
  92. mouseDistance = 1 * (getDistance(x, y, 0, 0) / (canvasWIDTH * canvasWIDTH / 324));
  93. } else {
  94. mouseDistance = 1;
  95. }
  96. }
  97. }
  98.  
  99. document.onkeyup = function (key) {
  100. switch(key.keyCode) {
  101. case 69: //on E
  102. speedhack = false;
  103. if(!aimbot) {
  104. socket.emit('keyPress', {
  105. inputId: 'angle',
  106. state: mouseAngle
  107. });
  108. }
  109. socket.emit('keyPress', {
  110. inputId: 'mouseDistance',
  111. state: 1
  112. });
  113. break;
  114. case 87: //on W
  115. inputAttack(false);
  116. break;
  117. case 32: //on SPACE
  118. inputDash(false);
  119. break;
  120. case 13:
  121. inputChat(); //on ENTER
  122. break;
  123. case 80: //on P
  124. if(!typing) {
  125. tFunction();
  126. }
  127. break;
  128. default:
  129. break;
  130. }
  131. }
  132.  
  133. document.onkeydown = function (key) {
  134. //if(document.getElementById('chatMessage') == null) {
  135. if(!typing) {
  136. switch(key.keyCode) {
  137. case 68: //on D
  138. autorespawn = !autorespawn;
  139. break;
  140. case 81: //on Q
  141. aimbot = !aimbot;
  142. if(!aimbot) {
  143. socket['emit']('keyPress', {
  144. inputId: 'leftButton',
  145. state: false
  146. });
  147. isAimbotActive = false;
  148. }
  149. break;
  150. case 90: //on Z
  151. tracers = !tracers;
  152. break;
  153. case 65: //on A
  154. staying = !staying;
  155. break;
  156. case 69: //on E
  157. if(!aimbot && !speedhack) {
  158. socket.emit('keyPress', {
  159. inputId: 'angle',
  160. state: ((mouseAngle + 180) % 360)
  161. });
  162. }
  163. socket.emit('keyPress', {
  164. inputId: 'mouseDistance',
  165. state: -5000
  166. });
  167. speedhack = true;
  168. break;
  169. case 87: //on W
  170. inputAttack(true);
  171. break;
  172. case 32: //on Space
  173. inputDash(true);
  174. break;
  175. default:
  176. break;
  177. }
  178. }
  179. }
  180.  
  181. function onRender() {
  182. if(tracers && Player.list[selfId] != undefined && Player.list[selfId].map != undefined && Player.list[selfId].map != 'menu') {
  183. for(var playerId in Player.list) {
  184. if(playerId != selfId) {
  185. var target = Player.list[playerId];
  186. var diffX = target.x - Player.list[selfId].x;
  187. var diffY = target.y - Player.list[selfId].y;
  188. var currentDistance = Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2));
  189. if(currentDistance != undefined && !isNaN(currentDistance) && currentDistance <= 1000) {
  190. ctx.beginPath();
  191. ctx.moveTo(WIDTH / 2, HEIGHT / 2);
  192. ctx.arc(WIDTH / 2, HEIGHT / 2, 1, 0, 2 * Math.PI, true);
  193. ctx.lineTo(diffX + WIDTH / 2, diffY + HEIGHT / 2);
  194. ctx.arc(diffX + WIDTH / 2, diffY + HEIGHT / 2, 1, 0, 2 * Math.PI, true);
  195. ctx.lineWidth = 2;
  196. ctx.strokeStyle = "#e74c3c";
  197. ctx.stroke();
  198. }
  199. }
  200. }
  201. }
  202.  
  203. ctx.font = "20px Comic Sans MS";
  204. ctx.textAlign = "center";
  205.  
  206. ctx.fillStyle = tracers ? "green" : "red";
  207. ctx.fillText("Tracers [Z]", 80, 105);
  208.  
  209. ctx.fillStyle = staying ? "green" : "red";
  210. ctx.fillText("Staying [A]", 80, 130);
  211.  
  212. ctx.fillStyle = speedhack ? "green" : "red";
  213. ctx.fillText("SpeedHack [E]", 80, 155);
  214.  
  215. requestAnimationFrame(onRender);
  216. }
  217.  
  218. onRender();
  219.  
  220. animate = function() {
  221. intervalTimer++;
  222. requestAnimationFrame(animate);
  223. if (!selfId) {
  224. return;
  225. }
  226. ctx.clearRect(0, 0, WIDTH, HEIGHT);
  227. for (var PlayerID in Player.list) {
  228. Player.list[PlayerID].update();
  229. }
  230. for (var NpcID in NPC.list) {
  231. NPC.list[NpcID].update();
  232. }
  233. for (var MobID in Mob.list) {
  234. Mob.list[MobID].update();
  235. }
  236. for (var BulletID in Bullet.list) {
  237. Bullet.list[BulletID].update();
  238. }
  239. drawMap();
  240. if (intervalTimer % FPS == 0) {
  241. manageMusic();
  242. }
  243. if (intervalTimer % 4 == 0 && Player.list[selfId].map == 'menu') {
  244. manageShop();
  245. manageHighScore();
  246. }
  247. if (Player['list'][selfId]['map'] == 'menu') {
  248. if (adTimer2++ > 60 * FPS) {
  249. aipDisplayTag['refresh']('fightz-io_336x280');
  250. aipDisplayTag['refresh']('fightz-io_300x250');
  251. adTimer2 = 0;
  252. }
  253. } else {
  254. adTimer2 = 0;
  255. }
  256. if (intervalTimer % 8 == 0 && Player['list'][selfId]['map'] !== 'menu') {
  257. if (Math['abs'](angleStatus - mouseAngle) > 1 || Math['abs'](distanceStatus - mouseDistance) > 0.1) {
  258. if(!isAimbotActive) {
  259. socket.emit('keyPress', {
  260. inputId: 'angle',
  261. state: speedhack ? (mouseAngle + 180) % 360 : mouseAngle
  262. });
  263. }
  264. socket.emit('keyPress', {
  265. inputId: 'mouseDistance',
  266. state: speedhack ? -5 : (staying ? 0 : mouseDistance)
  267. });
  268. angleStatus = mouseAngle;
  269. distanceStatus = mouseDistance;
  270. }
  271. }
  272. for (var DecorationID in Decoration.list) {
  273. if (Decoration.list[DecorationID].type != 35) {
  274. Decoration.list[DecorationID].draw();
  275. }
  276. }
  277. for (var foodID in Food.list) {
  278. Food.list[foodID].draw();
  279. }
  280. for (var mobID in Mob.list) {
  281. Mob.list[mobID].draw();
  282. }
  283. for (var ncpID in NPC.list) {
  284. NPC.list[ncpID].draw();
  285. }
  286. for (var bulletID in Bullet.list) {
  287. Bullet.list[bulletID].draw();
  288. }
  289. for (var playerID in Player.list) {
  290. Player.list[playerID].draw();
  291. }
  292. for (var decorationID in Decoration.list) {
  293. if (Decoration.list[decorationID].type == 35) {
  294. Decoration.list[decorationID].draw();
  295. }
  296. }
  297. for (var PLAYERID in Player.list) {
  298. Player.list[PLAYERID].drawMessage();
  299.  
  300. }
  301. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement