TargetControll
-
///api_version=2
const script = registerScript({
name: "VKKILLAURA",
authors: [":)"],
version: "1.0"
}).import("Core.lib");// Indstillinger for KillAura
const rangeValue = value.createFloat("Range", 4.0, 3.0, 6.0);
const cpsValue = value.createInteger("CPS", 10, 1, 20);
const rotationSpeedValue = value.createList("RotationSpeed", ["Slow", "Medium", "Fast"], "Medium");// Mål liste
const targetList = [];
let isEnabled = false;// Opdatering af mållisten
function updateTargetList(name, action) {
if (action === "add" && !targetList.includes(name)) {
targetList.push(name);
Client.displayChatMessage(§aAdded ${name} to target list.
);
} else if (action === "remove") {
const index = targetList.indexOf(name);
if (index > -1) {
targetList.splice(index, 1);
Client.displayChatMessage(§cRemoved ${name} from target list.
);
}
}
}// Registrer kommandoer
script.registerCommand({
name: ".vk",
description: "Manage KillAura target list.",
hub: true,
subcommands: [
{
name: "add",
parameters: [{ name: "name", required: true }],
onExecute(name) {
updateTargetList(name, "add");
}
},
{
name: "remove",
parameters: [{ name: "name", required: true }],
onExecute(name) {
updateTargetList(name, "remove");
}
},
{
name: "list",
onExecute() {
if (targetList.length === 0) {
Client.displayChatMessage("§eTarget list is empty.");
} else {
Client.displayChatMessage("§eTargets: " + targetList.join(", "));
}
}
},
{
name: "toggle",
onExecute() {
isEnabled = !isEnabled;
Client.displayChatMessage(§eKillAura is now ${isEnabled ? "enabled" : "disabled"}.
);
}
}
]
});// Hent mål inden for rækkevidde
function getTargetsInRange(range) {
const targets = [];
for (const entity of mc.theWorld.loadedEntityList) {
if (entity !== mc.thePlayer && entity.getDistanceToEntity(mc.thePlayer) <= range) {
targets.push(entity);
}
}
return targets;
}// Angrebsmål
function attackTarget(target) {
if (targetList.includes(target.getName())) {
mc.thePlayer.swingItem();
mc.playerController.attackEntity(mc.thePlayer, target);
}
}// Opdatering af angreb
script.on("update", () => {
if (!isEnabled) return;const targets = getTargetsInRange(rangeValue.get()); for (const target of targets) { attackTarget(target); sleep(1000 / cpsValue.get()); // CPS }
});
// Aktiver modulet
script.on("enable", () => {
Client.displayChatMessage("§eVKKILLAURA module enabled.");
});// Deaktiver modulet
script.on("disable", () => {
isEnabled = false;
targetList.length = 0; // Rydder mål listen
Client.displayChatMessage("§eVKKILLAURA module disabled.");
});This dose not work at all, i made it with chatgpt and i have no coding experience, what i want it to do is to make killaura target the players on the list i can interact with the list with these commands:
.vka -active/deactivate
.vk "Name" -adds a player
.vkf "name" -removes a player
.vkl -shows the listI hope that someone can help me fix the script so that i can target the players i want- Thanks!