TGViewer
ботик ботик @botikst · 22 subscribers
Post #64 122
Буфер появления кнопки
import { world, system } from "@minecraft/server";
import { ActionFormData } from "@minecraft/server-ui";

function UI(player) {
const form = new ActionFormData();
form.title("меню");
form.body(`чтобы появилась кнопка, выдайте себе тег "custom" и кнопка появится в меню`);
form.button("кнопка без тега");
if (player.hasTag("custom")) {
form.button("кнопка с тегом №1");
}
if (player.hasTag("cus")) {
form.button("кнопка с тегом №2");
}

form.show(player).then(result => {
if (result.selection === undefined) return;

if (result.selection === 0) {
player.sendMessage("Вы нажали кнопку без тега");
} else if (result.selection === 1 && player.hasTag("custom")) {
player.sendMessage("Вы нажали кнопку с тегом №1");
} else if (result.selection === 2 && player.hasTag("cus")) {
player.sendMessage("Вы нажали кнопку с тегом №2");
}
});
}

world.beforeEvents.itemUse.subscribe((eventData) => {
if (eventData.itemStack?.typeId === "minecraft:stick") {
let player = eventData.source;
system.run(() => {
UI(player);
});
}
});
More from @botikst
  1. Sep 6, 2026пример WebSocket10
  2. Sep 6, 2026Файл скрипт WebSocket10
  3. Sep 6, 2026файл apk termux
  4. Sep 6, 2026Скрипт WebSocket10 const TelegramBot = require('node-telegram-bot-api'); const WebSocket =…
  5. Sep 6, 2026Команды termux: termux-setup-storage pkg update && pkg upgrade -y pkg install nodejs-lts n…
  6. Jul 26, 2026Пример «Импульс»
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →