Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name uweistlost
- // @namespace uweistlost
- // @version 1.2.1
- // @description uweistlost
- // @author le0nmky
- // @match *.swordz.io
- // @grant uweistlost
- // ==/UserScript==
- (function() {
- })();
- var aimbot = false;
- var tracers = true;
- var staying = false;
- var speedhack = false;
- var autorespawn = false;
- var isAimbotActive = false;
- function onUpdate() {
- if(autorespawn && Player.list[selfId].map == "menu" && respawnButton.style.display != " ") {
- respawnButton.click();
- playButton.click();
- }
- if(Player.list[selfId].map != undefined && Player.list[selfId].map != 'menu') {
- if(staying) {
- socket.emit('keyPress', {
- inputId: 'mouseDistance',
- state: 0
- });
- }
- if(aimbot) {
- var prevPlayer = {};
- var diffX;
- var diffY;
- for(var playerId in Player.list) {
- if(playerId != selfId) {
- var otherPlayer = Player.list[playerId];
- if(otherPlayer.map != undefined && otherPlayer.map != "menu") {
- diffX = otherPlayer.x - Player.list[selfId].x;
- diffY = otherPlayer.y - Player.list[selfId].y;
- var currentDistance = Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2));
- if(prevPlayer.distance != undefined) {
- if(currentDistance <= prevPlayer.distance) {
- prevPlayer.player = otherPlayer;
- prevPlayer.distance = currentDistance;
- }
- } else {
- prevPlayer.player = otherPlayer;
- prevPlayer.distance = currentDistance;
- }
- }
- }
- }
- if(isAimbotActive = (prevPlayer.distance != undefined && !isNaN(prevPlayer.distance) && prevPlayer.distance <= 500)) {
- diffX = prevPlayer.player.x - Player.list[selfId].x;
- diffY = prevPlayer.player.y - Player.list[selfId].y;
- mouseAngle = (Math.atan2(diffY, diffX) * 180 / Math.PI);
- //AutoAttack
- socket.emit('keyPress', {
- inputId: 'angle',
- state: speedhack ? (mouseAngle + 180) % 360 : mouseAngle
- });
- socket['emit']('keyPress', {
- inputId: 'leftButton',
- state: true
- });
- }
- }
- }
- }
- setInterval(onUpdate, 100);
- document.onmousemove = function (info) {
- if (info.clientX < 110 && info.clientY > window.innerHeight - 310) {
- return;
- }
- if (Player.list[selfId] && Player.list[selfId].map != 'menu') {
- var x = -canvasWIDTH / 2 + info.clientX;
- var y = -canvasHEIGHT / 2 + info.clientY;
- if(!isAimbotActive) {
- mouseAngle = Math.atan2(y, x) / Math.PI * 180;
- }
- mouseDistance = 1;
- if (getDistance(x, y, 0, 0) < canvasWIDTH * canvasWIDTH / 324) {
- mouseDistance = 1 * (getDistance(x, y, 0, 0) / (canvasWIDTH * canvasWIDTH / 324));
- } else {
- mouseDistance = 1;
- }
- }
- }
- document.onkeyup = function (key) {
- switch(key.keyCode) {
- case 69: //on E
- speedhack = false;
- if(!aimbot) {
- socket.emit('keyPress', {
- inputId: 'angle',
- state: mouseAngle
- });
- }
- socket.emit('keyPress', {
- inputId: 'mouseDistance',
- state: 1
- });
- break;
- case 87: //on W
- inputAttack(false);
- break;
- case 32: //on SPACE
- inputDash(false);
- break;
- case 13:
- inputChat(); //on ENTER
- break;
- case 80: //on P
- if(!typing) {
- tFunction();
- }
- break;
- default:
- break;
- }
- }
- document.onkeydown = function (key) {
- //if(document.getElementById('chatMessage') == null) {
- if(!typing) {
- switch(key.keyCode) {
- case 68: //on D
- autorespawn = !autorespawn;
- break;
- case 81: //on Q
- aimbot = !aimbot;
- if(!aimbot) {
- socket['emit']('keyPress', {
- inputId: 'leftButton',
- state: false
- });
- isAimbotActive = false;
- }
- break;
- case 90: //on Z
- tracers = !tracers;
- break;
- case 65: //on A
- staying = !staying;
- break;
- case 69: //on E
- if(!aimbot && !speedhack) {
- socket.emit('keyPress', {
- inputId: 'angle',
- state: ((mouseAngle + 180) % 360)
- });
- }
- socket.emit('keyPress', {
- inputId: 'mouseDistance',
- state: -5000
- });
- speedhack = true;
- break;
- case 87: //on W
- inputAttack(true);
- break;
- case 32: //on Space
- inputDash(true);
- break;
- default:
- break;
- }
- }
- }
- function onRender() {
- if(tracers && Player.list[selfId] != undefined && Player.list[selfId].map != undefined && Player.list[selfId].map != 'menu') {
- for(var playerId in Player.list) {
- if(playerId != selfId) {
- var target = Player.list[playerId];
- var diffX = target.x - Player.list[selfId].x;
- var diffY = target.y - Player.list[selfId].y;
- var currentDistance = Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2));
- if(currentDistance != undefined && !isNaN(currentDistance) && currentDistance <= 1000) {
- ctx.beginPath();
- ctx.moveTo(WIDTH / 2, HEIGHT / 2);
- ctx.arc(WIDTH / 2, HEIGHT / 2, 1, 0, 2 * Math.PI, true);
- ctx.lineTo(diffX + WIDTH / 2, diffY + HEIGHT / 2);
- ctx.arc(diffX + WIDTH / 2, diffY + HEIGHT / 2, 1, 0, 2 * Math.PI, true);
- ctx.lineWidth = 2;
- ctx.strokeStyle = "#e74c3c";
- ctx.stroke();
- }
- }
- }
- }
- ctx.font = "20px Comic Sans MS";
- ctx.textAlign = "center";
- ctx.fillStyle = tracers ? "green" : "red";
- ctx.fillText("Tracers [Z]", 80, 105);
- ctx.fillStyle = staying ? "green" : "red";
- ctx.fillText("Staying [A]", 80, 130);
- ctx.fillStyle = speedhack ? "green" : "red";
- ctx.fillText("SpeedHack [E]", 80, 155);
- requestAnimationFrame(onRender);
- }
- onRender();
- animate = function() {
- intervalTimer++;
- requestAnimationFrame(animate);
- if (!selfId) {
- return;
- }
- ctx.clearRect(0, 0, WIDTH, HEIGHT);
- for (var PlayerID in Player.list) {
- Player.list[PlayerID].update();
- }
- for (var NpcID in NPC.list) {
- NPC.list[NpcID].update();
- }
- for (var MobID in Mob.list) {
- Mob.list[MobID].update();
- }
- for (var BulletID in Bullet.list) {
- Bullet.list[BulletID].update();
- }
- drawMap();
- if (intervalTimer % FPS == 0) {
- manageMusic();
- }
- if (intervalTimer % 4 == 0 && Player.list[selfId].map == 'menu') {
- manageShop();
- manageHighScore();
- }
- if (Player['list'][selfId]['map'] == 'menu') {
- if (adTimer2++ > 60 * FPS) {
- aipDisplayTag['refresh']('fightz-io_336x280');
- aipDisplayTag['refresh']('fightz-io_300x250');
- adTimer2 = 0;
- }
- } else {
- adTimer2 = 0;
- }
- if (intervalTimer % 8 == 0 && Player['list'][selfId]['map'] !== 'menu') {
- if (Math['abs'](angleStatus - mouseAngle) > 1 || Math['abs'](distanceStatus - mouseDistance) > 0.1) {
- if(!isAimbotActive) {
- socket.emit('keyPress', {
- inputId: 'angle',
- state: speedhack ? (mouseAngle + 180) % 360 : mouseAngle
- });
- }
- socket.emit('keyPress', {
- inputId: 'mouseDistance',
- state: speedhack ? -5 : (staying ? 0 : mouseDistance)
- });
- angleStatus = mouseAngle;
- distanceStatus = mouseDistance;
- }
- }
- for (var DecorationID in Decoration.list) {
- if (Decoration.list[DecorationID].type != 35) {
- Decoration.list[DecorationID].draw();
- }
- }
- for (var foodID in Food.list) {
- Food.list[foodID].draw();
- }
- for (var mobID in Mob.list) {
- Mob.list[mobID].draw();
- }
- for (var ncpID in NPC.list) {
- NPC.list[ncpID].draw();
- }
- for (var bulletID in Bullet.list) {
- Bullet.list[bulletID].draw();
- }
- for (var playerID in Player.list) {
- Player.list[playerID].draw();
- }
- for (var decorationID in Decoration.list) {
- if (Decoration.list[decorationID].type == 35) {
- Decoration.list[decorationID].draw();
- }
- }
- for (var PLAYERID in Player.list) {
- Player.list[PLAYERID].drawMessage();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement