
World Code
Tags:
None
Creator:
PwrCat
Code:
// define speed for colors
const green = 4;
const yellow = 8;
const red = 12;
const black = 16;
const blue = 20;
const purple = 24;
const orange = 28;
const white = 32;
const cyan = 36;
const magenta = 40;
// commands to give blocks and to help
playerCommand = (playerId, command) => {
if(command === "speedHack") {
api.setItemSlot(playerId, 0, "Green Portal", 1);
api.setItemSlot(playerId, 1, "Yellow Portal", 1);
api.setItemSlot(playerId, 2, "Red Portal", 1);
api.setItemSlot(playerId, 3, "Black Portal", 1);
api.setItemSlot(playerId, 4, "Blue Portal", 1);
api.setItemSlot(playerId, 5, "Purple Portal", 1);
api.setItemSlot(playerId, 6, "Orange Portal", 1);
api.setItemSlot(playerId, 7, "White Portal", 1);
api.setItemSlot(playerId, 8, "Cyan Portal", 1);
api.setItemSlot(playerId, 9, "Magenta Portal", 1);
return true;
}
if(command === "speedHelp") {
api.sendMessage(playerId, " -- Speed hack help --\nUse /speedHack AFTER CLEARED YOU HOTBAR\n(use the command before clear will remove items you have in)", { color: "yellow" });
return true;
}
}
function tick() {
const playerIds = api.getPlayerIds();
for (const id of playerIds) {
const item = api.getHeldItem(id);
if (item && item.name === "Green Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:green});
}
if (item && item.name === "Yellow Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:yellow});
}
if (item && item.name === "Red Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:red});
}
if (item && item.name === "Black Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:black});
}
if (item && item.name === "Blue Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:blue});
}
if (item && item.name === "Purple Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:purple});
}
if (item && item.name === "Orange Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:orange});
}
if (item && item.name === "White Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:white});
}
if (item && item.name === "Cyan Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:cyan});
}
if (item && item.name === "Magenta Portal") {
api.applyEffect(id, "Speed", 1000, {inbuiltLevel:magenta});
}
}
}Instructions:
use command /speedHelp to show the help