import { world, system } from "@minecraft/server";
world.beforeEvents.chatSend.subscribe((data) => {
fik(data)
})
function fik(data) {
const send = data.sender;
const message = data.message;
const cach1 = message === "!start";
const cach2 = message === "!help";
const cach3 = message === "!menu";
const cach4 = message === "!admin";
const ff = message === "!";
const cancel = (cach1 || cach2 || cach3 || cach4 || ff) && (data.cancel = true);
const che1 = cach1 && system.run(() => {
send.runCommand(`title @a title команда start`);
});
const che2 = cach2 && system.run(() => {
send.runCommand(`title @a title команда help`);
});
const che3 = cach3 && system.run(() => {
send.runCommand(`title @a title команда menu`);
});
const che4 = cach4 && system.run(() => {
if (send.hasTag("op")) {
send.runCommand(`title @a title команда admin`);
} else {
send.runCommand(`title @a title нет тега "op"`);
}
});
const ffi = ff && system.run(() => {
send.sendMessage(`!start\n!help\n!menu\n!admin (tag=op)`);
});
return;
} Post #96
60
Скрипт команды (chatSend)