Bloxd Stubbed SURVS
Fri Aug 21 2026 13:10:16 GMT+0000 (Coordinated Universal Time)
Saved by @ItzStubZ
// ==========================================
// 0. Defining & Configurations
// ==========================================
const DEV_NAMES = ["ItzStubZ"];
function isDev(playerId) {
return DEV_NAMES.includes(api.getEntityName(playerId));
}
// Combined Join Handler for Sidebar Info and Shop Setup
onPlayerJoin = (playerId) => {
// Code 1: Sidebar Setup
api.setClientOption(playerId, "RightInfoText", [
{ str: "Stubbed Survival ", style: { color: "gold", fontWeight: "bold", fontSize: "20px" } },
{ str: "————————————————————————\n", style: { color: "lightgrey", fontWeight: "bold" } },
{ str: "————————————————————————\n", style: { color: "lightgrey", fontWeight: "bold", fontSize: "15px" } },
{ icon: "star", style: { fontSize: "14px", color: "#FFFFA6" } },
{ str: " !help for a list of commands\n Type !rtp to get started!\n", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: "————————————————————————", style: { color: "lightgrey", fontWeight: "bold", fontSize: "15px" } }
]);
// Code 2: Shop Setup
api.createShopItem("classicGame:utilities", "rtp", {
image: "Compass",
customTitle: "Random Teleport",
description: "TP to random place",
buyButtonText: "Teleport"
});
api.configureShopCategory("classicGame:utilities", {
customTitle: "Utilities"
});
};
// ==========================================
// 1. Shop & Commands Handlers (Code 2)
// ==========================================
tick = (ms) => {};
onPlayerBoughtShopItem = (playerId, categoryKey, itemKey, item, userInput) => {
if (itemKey === "rtp") {
const randomX = Math.floor(Math.random() * 200000) - 100000;
const randomY = 100;
const randomZ = Math.floor(Math.random() * 200000) - 100000;
api.setPosition(playerId, [randomX, randomY, randomZ]);
// Fixed template literals to correctly display the coordinates
api.sendMessage(playerId, "Téléporté à [" + randomX + ", " + randomY + ", " + randomZ + "]", { color: "cyan" });
api.broadcastMessage(api.getEntityName(playerId) + " used rtp!", { color: "yellow" });
}
};
playerCommand = (playerId, command) => {
if (command === "shop") {
api.openShop(playerId);
return true;
}
return false;
};
// ==========================================
// 2. Chat Command Handler (Code 1)
// ==========================================
function onPlayerChat(id, msg) {
const trimmedMsg = msg.trim();
const lowerMsg = trimmedMsg.toLowerCase();
// !rtp Chat Command
if (lowerMsg === "!rtp") {
const x = Math.floor(200000 * Math.random() - 100000);
const z = Math.floor(200000 * Math.random() - 100000);
const y = 125;
api.setPosition(id, [x, y, z]);
api.sendMessage(id, "Succesfully Teleported", {color: "lime"});
return false;
}
// !help Menu
if (lowerMsg === "!help") {
const helpMessage = [
{ str: "Stubbed Survival Commands\n", style: { color: "#5CFF5C", fontWeight: "bold" } },
{ str: "!rtp", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Random teleport\n", style: { color: "white" } },
{ str: "!bal", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Check your MelonBucks\n", style: { color: "white" } },
{ str: "!msg <player> <msg>", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Privately message a player\n", style: { color: "white" } },
{ str: "!r.p <character> <text>", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Broadcast a roleplay message\n", style: { color: "white" } },
{ str: "!help", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Shows this menu", style: { color: "white" } }
];
if (isDev(id)) {
helpMessage.push(
{ str: "\n!dev help", style: { color: "#FF5555", fontWeight: "bold" } },
{ str: " - Developer commands", style: { color: "white" } }
);
}
api.sendMessage(id, helpMessage);
return false;
}
// !r.p <character> <text>
if (lowerMsg.startsWith("!r.p ")) {
const args = trimmedMsg.split(" ");
if (args.length < 3) {
api.sendMessage(id, "Usage: !r.p <character> <text>", { color: "red" });
return false;
}
const characterName = args[1];
const roleplayText = args.slice(2).join(" ");
api.broadcastMessage([
{ str: "[Roleplay] ", style: { color: "#00FFCC", fontWeight: "bold" } },
{ str: characterName + ": ", style: { color: "#FFD700", fontWeight: "bold" } },
{ str: roleplayText, style: { color: "#FFFFFF" } }
]);
return false;
}
// !msg <player> <msg>
if (lowerMsg.startsWith("!msg ")) {
const args = trimmedMsg.split(" ");
if (args.length < 3) {
api.sendMessage(id, "Usage: !msg <player> <msg>", { color: "red" });
return false;
}
const targetName = args[1];
const dmMessage = args.slice(2).join(" ");
const targetId = api.getPlayerId(targetName);
if (targetId === null) {
api.sendMessage(id, "Player not found: " + targetName, { color: "red" });
return false;
}
const senderName = api.getEntityName(id);
api.sendMessage(targetId, [
{ str: "[Msg] ", style: { color: "#FF77FF", fontWeight: "bold" } },
{ str: senderName + ": ", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: dmMessage, style: { color: "white" } }
]);
api.sendMessage(id, [
{ str: "[Msg → " + targetName + "] ", style: { color: "#FF77FF", fontWeight: "bold" } },
{ str: dmMessage, style: { color: "white" } }
]);
return false;
}
// !dev help
if (lowerMsg === "!dev help") {
if (!isDev(id)) {
api.sendMessage(id, "Unknown command. Type !help.", { color: "red" });
return false;
}
api.sendMessage(id, [
{ str: "Developer Commands\n", style: { color: "#FF5555", fontWeight: "bold" } },
{ str: "!message <normal|bold> <colour> <msg>", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Broadcast a server message\n", style: { color: "white" } },
{ str: "!kill <player>", style: { color: "#FFFFA6", fontWeight: "bold" } },
{ str: " - Kill a player", style: { color: "white" } }
]);
return false;
}
// !message <normal|bold> <colour> <msg>
if (lowerMsg.startsWith("!message ")) {
if (!isDev(id)) {
api.sendMessage(id, "Unknown command. Type !help.", { color: "red" });
return false;
}
const args = trimmedMsg.split(" ");
if (args.length < 4) {
api.sendMessage(id, "Usage: !message <normal|bold> <colour> <msg>", { color: "red" });
return false;
}
const weight = args[1].toLowerCase();
const colour = args[2];
const message = args.slice(3).join(" ");
if (weight !== "normal" && weight !== "bold") {
api.sendMessage(id, "First option must be normal or bold.", { color: "red" });
return false;
}
api.broadcastMessage(message, {
color: colour,
fontWeight: weight
});
return false;
}
// !kill <player>
if (lowerMsg.startsWith("!kill ")) {
if (!isDev(id)) {
api.sendMessage(id, "Unknown command. Type !help.", { color: "red" });
return false;
}
const targetName = trimmedMsg.slice(6).trim();
const targetId = api.getPlayerId(targetName);
if (!targetName) {
api.sendMessage(id, "Usage: !kill <player>", { color: "red" });
return false;
}
if (targetId === null) {
api.sendMessage(id, "Player not found: " + targetName, { color: "red" });
return false;
}
api.setHealth(targetId, 0);
api.sendMessage(id, [
{ str: "Killed ", style: { color: "#FF5555" } },
{ str: targetName, style: { color: "white", fontWeight: "bold" } },
{ str: ".", style: { color: "#FF5555" } }
]);
return false;
}
}
// ==========================================
// 3. Totem Logic & Game Actions
// ==========================================
onAttemptKillPlayer = (v) => {
if (api.getEffects(v).includes("Totem")) {
let pos = api.getPosition(v);
api.applyEffect(v, "Health Regen", 3e4, {inbuiltLevel: 2});
api.applyEffect(v, "Heat Resistance", 1e4, {inbuiltLevel: 1});
api.applyEffect(v, "Damage Reduction", 3e4, {inbuiltLevel: 2});
api.applyEffect(v, "Damage", 1e4, {inbuiltLevel: 2});
api.applyEffect(v, "Speed", 1e4, {inbuiltLevel: 2});
api.setHealth(v, 30);
api.setShieldAmount(v, 50);
if (api.getHeldItem(v)?.attributes.customDisplayName === "Totem Of Undying") {
let s = api.getSelectedInventorySlot(v);
api.setItemSlot(v, s, "Air");
api.removeEffect(v, "Totem");
return "preventDeath";
} else {
api.removeEffect(v, "Totem");
return "preventDeath";
}
}
};
// Cleaned up the unfinished handler from Code 1 to prevent syntax errors
onPlayerAttemptAltAction = (id) => {
if (api.getHeldItem(id)?.name == "Gold Spade" && api.getHeldItem(id)?.attributes.customDisplayName == "Totem") {
// Your alternative action logic here
}
};



Comments