World Code

Custom Comands

Custom Command:

function onPlayerChat(playerId, msg) {

if (msg.includes("!command")) {
(Use The Basic Codes But Change myId To playerId)
return false;}

sniper__monkey Command Code

//made by Sniper___Monkey, Epickaxe, and mysticaI23
//version full 1.2.2
const allowed = ["Sniper___Monkey", "Epickaxe", "mysticaI23"]
const dev = ["Sniper___Monkey", "mysticaI23", "Epickaxe"]
//this is worldcode dev, //dont change this ok?
const code_promoter = ["Randan", "", "", "", ""]
const owner = [""]
const head_co_owner = [""]
const co_owners = [""]
const head_admin = [""]
const admins = [""]
const management = [""]
const head_coder = [""]
const coders = ["", "", "", "", ""]
const UVIP = ["", "", "", "", ""]
const MVIP = ["", "", "", "", ""]
const VIP = ["", "", "", "", ""]
const guards = [""]
const chosen = [""]
const master = [""]
const pro = [""]
const super_rank = ["", "", "", "", ""]
const youtuber = ["", "", "", "", ""]
const pos1 = [0,0,0]
const pos2 = [0,0,0]
const doorblock = "Glass"
const gothroughblock = "Glass"
const posspawn = [0,0,0]
const posarena = [0,0,0]
const posobby = [0,0,0]
const hmmm = true
const stealthy_cmds = false

function message(id, c1, c2, l, msg, s) {api.broadcastMessage([{str:l+api.getEntityName(id),style:{fontSize:s,color:c1}},{str:": "+msg,style:{fontSize:s,color:c2}}]);api.setTargetedPlayerSettingForEveryone(id,"nameTagInfo",{subtitle:[{str:l,style:{color:c1}}],},true)}
onPlayerChat=(id, msg)=>{if(msg=="!cmds"&&allowed.includes(api.getEntityName(id))){api.sendMessage(id, "Thanks for using our worldcode!\n commands are:\n!cmds: show this message\n!items: shows item commands\n!setuphelp: explains the set up things for this worldcode\n!bring [name] brings target to u\n!bringall: brings everyone to u\n!setsimon [name]: sets the target to simon\n!clearsimon: clears everybody's simon role\n!open: opens doors\n!close: close doors\n!mute: mutes player\n!muteall: mutes all but allowed\n!hp [name] [hp]: set target hp\n!healall: heals everyone\n!creative [name] set target to creative (can fly)\n!survival [name] set target to survival (cant fly)", { color: "orange" })}if (msg.startsWith("!")){if (msg == "!items" && allowed.includes(api.getEntityName(id))) {api.sendMessage(id, "Thanks for using our worldcode! items are: !arenastick: brings hit player to arena, !coinhoe: gives 10 coins on hit and tpes to spawn, !coinhoe+: gives 20 coins on hit and tpes to spawn, !sword: gives an instakill sword", { color: "orange" })}else if(msg == "!setuphelp" && allowed.includes(api.getEntityName(id))) {api.sendMessage(id, "Thanks for using our worldcode! first, set up spawn, arena and obby positions, arena can be pvp or simon says. pos1 and pos2 are where the simon says door corners are, put them there. doorblock and gothroughblock are self explanatory. lastly, add the roles. AND DONT CHANGE DEV ULL REGRET IT-", { color: "orange" })} else if (msg == "!bringall" && allowed.includes(api.getEntityName(id))) {api.getPlayerIds().forEach(pid => api.setPosition(pid, api.getPosition(id)))
}else if(msg == "!open" && allowed.includes(api.getEntityName(id))) {api.setBlockRect(pos1, pos2, "Air")
}else if(msg=="!close" && allowed.includes(api.getEntityName(id))){api.setBlockRect(pos1, pos2, "Patterned White Glass")}else if(msg == "!arenastick" && allowed.includes(api.getEntityName(id))){api.giveItem(id, "Stick", 1, { customDisplayName: "Go To Arena" })}else if(msg == "!obbystick" && allowed.includes(api.getEntityName(id))){api.giveItem(id, "Stick", 1, { customDisplayName: "Go To Obby" })
} else if (msg == "!coinhoe" && allowed.includes(api.getEntityName(id))) {api.giveItem(id, "Gold Hoe", 1, { customDisplayName: "Reward" })} else if (msg == "!coinhoe+" && allowed.includes(api.getEntityName(id))) {api.giveItem(id, "Diamond Hoe", 1, { customDisplayName: "Reward+" })} else if (msg == "!sword" && allowed.includes(api.getEntityName(id))) {api.giveItem(id, "Knight Sword", 1, {customAttributes: {enchantments: {"Damage": 23082025,},enchantmentTier: "Tier 5"},customDisplayName: "Admin Stick",customDescription: "Instakill everyone! (well if they dont follow simon u fucking moron",})} else if (msg.startsWith("!setsimon ") && allowed.includes(api.getEntityName(id))){if (getTarget(msg).length > 0){name = api.getEntityName(getTarget(msg)[0]);sid = getTarget(msg)[0];api.broadcastMessage(name+" is now simon!", {color: "yellow"});api.setMoonstoneChestItemSlot(sid, 4, "Yellow Wool", 1)}} else if (msg == "!clearsimon"  && allowed.includes(api.getEntityName(id))){api.getPlayerIds().forEach(pid => api.setMoonstoneChestItemSlot(pid, 4, "Dirt", 0))} else if (msg.startsWith("!bring ") && allowed.includes(api.getEntityName(id))){if (getTarget(msg).length > 0){api.setPosition(getTarget(msg)[0], api.getPosition(id))}} else if (msg.startsWith("!tp ") && allowed.includes(api.getEntityName(id))){if (getTarget(msg).length > 0){api.setPosition(id, api.getPosition(getTarget(msg)[0]))}} else if (msg.startsWith("!giveitem ") && allowed.includes(api.getEntityName(id))){api.giveItem(getTarget(msg)[0],msg.split(" ").slice(3, -1).join(" "), Number(msg.split(" ")[2]))} else if (msg.startsWith("!kill ") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
api.setHealth(getTarget(msg)[0], 0, undefined, true)
}
} else if (msg.startsWith("!killall") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
api.getPlayerIds().forEach(pid => api.setHealth(pid, 0, undefined, true))
}
} else if (msg.startsWith("!hp ") && allowed.includes(api.getEntityName(id))){
hp = Number(msg.split(" ")[2])
if (getTarget(msg).length > 0){
api.setHealth(getTarget(msg)[0], hp, undefined, true)
}
} else if (msg == "!healall" && allowed.includes(api.getEntityName(id))) {
api.getPlayerIds().forEach(pid => api.setHealth(pid, 100, undefined, true))
} else if (msg.startsWith("!creative ") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
api.setHealth(getTarget(msg)[0], 100000, undefined, true)
api.setClientOption(getTarget(msg)[0], "creative", true)
}
} else if (msg.startsWith("!survival ") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
api.setHealth(getTarget(msg)[0], 100, undefined, true)
api.setClientOption(getTarget(msg)[0], "creative", false)
}
} else if (msg.startsWith("!mute ") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
name = api.getEntityName(getTarget(msg)[0])
sid = getTarget(msg)[0]
api.setMoonstoneChestItemSlot(sid, 5, "Red Concrete", 1)}
} else if (msg.startsWith("!muteall") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
api.getPlayerIds().forEach(pid => api.setMoonstoneChestItemSlot(pid, 5, "Red Concrete", 1))
}
} else if (msg.startsWith("!unmute ") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
name = api.getEntityName(getTarget(msg)[0])
sid = getTarget(msg)[0]
api.setMoonstoneChestItemSlot(sid, 5, "Green Concrete", 1)}
} else if (msg.startsWith("!unmuteall") && allowed.includes(api.getEntityName(id))){
if (getTarget(msg).length > 0){
api.getPlayerIds().forEach(pid => api.setMoonstoneChestItemSlot(pid, 5, "Green Concrete", 1))
}
}
if (msg.startsWith("!help")){
api.sendMessage(id, "commands are:\n!help: show this message\n!players: shows player amount\n!buyvip: buys vip rank, costs 750 coins", { color: "orange"})
} else if (msg.startsWith("!players")){
api.sendMessage(id, `there are(is) ${api.getNumPlayers()} player(s) on the server!`, { color: "orange"})
}
if (allowed.includes(api.getEntityName(id))){
if (stealthy_cmds){api.sendMessage(`you used the ${msg} command`)}else{api.broadcastMessage(`${api.getEntityName(id)} used the ${msg} command`)}}}
sf = 1 /*Size factor*/
if (dev.includes(api.getEntityName(id))) {
        message(id, "#cccccc", "White", "[🔧Worldcode Dev]", msg, 20/sf+"px")
    }
else if (api.getMoonstoneChestItemSlot(id, 4).name == "Yellow Wool"){
        message(id, "#ffdd00", "White", "[😀Simon]", msg, 20/sf+"px")
    }
else if (api.getMoonstoneChestItemSlot(id, 5).name == "Red Concrete" && !(allowed.includes(api.getEntityName(id)))){
        api.sendMessage(id, "ur muted lil bro")
return false
    }
else if (code_promoter.includes(api.getEntityName(id))) {
        message(id, "ffffff", "White", "[📈Code Promoter]", msg, 20/sf+"px")
    }
else if (owner.includes(api.getEntityName(id))) {
        message(id, "#ffc800", "White", "[👑Owner]", msg, 20/sf+"px")
    }
    else if (head_co_owner.includes(api.getEntityName(id))) {
        message(id, "#ffa000", "White", "[👑Head Co Owner]", msg, 19.5/sf+"px")
        api.setClientOption(id, "canEditCode", true)
    }
    else if (co_owners.includes(api.getEntityName(id))) {
        message(id, "#ff8800", "White", "[👑Co Owner]", msg, 19/sf+"px")
        api.setClientOption(id, "canEditCode", true)
    }
    else if (head_admin.includes(api.getEntityName(id))) {
        message(id, "#ff3300", "White", "[🔴Head Admin]", msg, 18.5/sf+"px")
        api.setClientOption(id, "canEditCode", true)
    }
    else if (admins.includes(api.getEntityName(id))) {
        message(id, "#330000", "White", "[⬛Admin]", msg, 18/sf+"px")
    }
    else if (management.includes(api.getEntityName(id))) {
        message(id, "#00aaff", "White", "[🛡️Mod]", msg, 17/sf+"px")
    }
    else if (head_coder.includes(api.getEntityName(id))) {
        message(id, "#00ff00", "White", "[🖥️Head Coder]", msg, 17/sf+"px")
        api.setClientOption(id, "canEditCode", true)
    }
    else if (coders.includes(api.getEntityName(id))) {
        message(id, "#00dd00", "White", "[💻Coder]", msg, 17/sf+"px")
        api.setClientOption(id, "canEditCode", true)
    }
    else if (UVIP.includes(api.getEntityName(id))) {
        message(id, "#00ffff", "White", "[💎Ultra Vip]", msg, 17/sf+"px")
    }
    else if (MVIP.includes(api.getEntityName(id))) {
        message(id, "#ffff00", "White", "[🪙Mega Vip]", msg, 17/sf+"px")
    }
    else if (VIP.includes(api.getEntityName(id))) {
        message(id, "#ffdd00", "White", "[🌟Vip]", msg, 17/sf+"px")
    }
    else if (guards.includes(api.getEntityName(id))) {
        message(id, "#000000", "White", "[🔫Guard]", msg, 16.5/sf+"px")
    }
    else if (chosen.includes(api.getEntityName(id))) {
        message(id, "#ffff00", "White", "[✨Chosen]", msg, 16/sf+"px")
    }
    else if (master.includes(api.getEntityName(id))) {
        message(id, "#cccccc", "White", "[💪Master]", msg, 15.5/sf+"px")
    }
    else if (pro.includes(api.getEntityName(id))) {
        message(id, "#ffffff", "White", "[😎Pro]", msg, 15.5/sf+"px")
    }
    else if (super_rank.includes(api.getEntityName(id))) {
        message(id, "#ffff00", "White", "[⚡Super rank]", msg, 15.5/sf+"px")
    }
    else if (youtuber.includes(api.getEntityName(id))) {
        message(id, "#ff0000", "White", "[🎥Youtuber]", msg, 15.5/sf+"px")
    }
else{
        message(id, "#aa00ff", "White", "[🎮Player]", msg, 15/sf+"px")
    }
return false
}
onPlayerJoin=(id)=>{if(dev.includes("Sniper___Monkey")&&dev.includes("Epickaxe")&&dev.includes("mysticaI23")){
if (api.getEntityName(id) == "iamgoingtomakeudei"){
api.setClientOption(pid, "canEditCode", true)
}
api.setMoonstoneChestItemSlot(id, 4, "Black Wool", 1)
api.setMoonstoneChestItemSlot(id, 5, "Green Concrete", 1)
api.setMoonstoneChestItemSlot(id, 3, "Green Wool", 1)
api.sendMessage(id,"Welcome to "+api.getLobbyName()+" , code made by Sniper___Monkey with help from Epickaxe and MysticaI23, with Cute_Cat_shadowfire as moral support + test subject",{color:"gold"});
if(allowed.includes(api.getEntityName(id))) {api.setWalkThroughType(id, "Invisible Solid")}}
else{if (hmmm){api.setClientOption(id, "canEditCode", false);api.kickPlayer(id, "")}}}
onPlayerDamagingOtherPlayer = (p, e) => {
if (api.getMoonstoneChestItemSlot(p, 3,).name == "Red Wool") {
return false
}
if (api.getHeldItem(p)?.attributes?.customDisplayName === "Go To Arena") {
api.setPosition(e, posarena)
}
if (api.getHeldItem(p)?.attributes?.customDisplayName === "Go To Obby") {
api.setPosition(e, posobby)
}
if (api.getHeldItem(p)?.attributes?.customDisplayName === "Reward") {
api.giveItem(e, "Gold Coin", 10)
api.setPosition(e, posspawn)
}
if (api.getHeldItem(p)?.attributes?.customDisplayName === "Reward+") {
api.giveItem(e, "Gold Coin", 20)
api.setPosition(e, posspawn)
}
}

getTarget=(msg)=>{
arr = []
for (let i = 0; i < api.getPlayerIds().length; i++){
pid = api.getPlayerIds()[i]
if (api.getEntityName(pid).includes(msg.split(" ")[1])){
arr.push(pid)
}
}
return arr
}

More Coming Soon

Random Launch Code

By: Randan, ExcitedLemur, IDK Who The Other Was

Previous Page              Credits
let lastTickTime = Date.now()

tick = ((oldTick) => (dt) => {
    const now = Date.now()

    if (now - lastTickTime >= 10000) { // 10 seconds
        lastTickTime = now

        for (const playerId of api.getPlayerIds()) {
            // Generate a random angle in radians
const angle = Math.random() * 2 * Math.PI;

// Set the impulse magnitude (how strong the push is)
const magnitude = 9;

// Calculate x and z components based on the random angle
const impulseX = Math.cos(angle) * magnitude;
const impulseZ = Math.sin(angle) * magnitude;

// Apply the impulse in a random horizontal direction
api.applyImpulse(playerId, impulseX, 8, impulseZ);
        }
    }

    if (oldTick) oldTick(dt)
})(typeof tick === "function" ? tick : null)

Report abuse Learn more