World Code
Tags:
Command, New Feature
Creator:
Redstone_und_Pommes
Code:
const toggleState = {};
playerCommand = ((playerId, command, args) => {
if (command === "challenge toggle") {
toggleState[playerId] = !toggleState[playerId];
api.sendMessage(
playerId,
toggleState[playerId]
? "Challege Started"
: "Challenge Ended"
);
api.playSound(playerId, "levelup", 1, 1);
}
});
function isEnabled(playerId) {
return toggleState[playerId] === true;
}
onBlockStand = (playerId, x, y, z, blockName) => {
const players = api.getPlayerIds();
for (const playerId of players) {
if (!isEnabled(playerId)) continue;
api.setBlock(x, y, z, "Air")
y += 1
api.playParticleEffect({
presetId: "bonemeal",
pos1: [x, y, z],
pos2: [x + 1, y + 1, z + 1],
})
}
}Instructions:
If you but the code in the world code, and do /challenge toggle it turns on or off. If on all blocks you are standing on will disapear. It's a little challenge :) Dont mind the thumbnail xD