forked from JaylyDev/ScriptAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshopui.js
More file actions
38 lines (35 loc) · 1.03 KB
/
shopui.js
File metadata and controls
38 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { world } from "@minecraft/server";
import * as MinecraftUi from "@minecraft/server-ui";
const player = [...world.getPlayers()][0];
const Shopitems = [
{
liste_item: "liste_item",
prix: 10,
Icons: "textures/blocks/bedrock"
}
];
// Menu Shop
let shopui = new MinecraftUi.ActionFormData()
.title("§r§aOcto §eShop§r")
.button("§2Objets§8", "textures/items/apple.png")
.button("§2Utilitaires§8", "textures/ui/debug_glyph_color.png");
shopui.show(player).then((res) => {
if (res.canceled == true)
return player.runCommandAsync(
`tellraw ${player.name} {"rawtext": [{"text": "§r§8[§aOcto §eShop§8] §cAchat annulé!§r"}]}`
);
// MENU BLOCK
if (res.selection == 0) {
let blocksui = new MinecraftUi.ActionFormData();
blocksui.title("§r§aOcto §eShop§r");
for (const itemm of Shopitems) {
blocksui.button(
`§c${itemm.liste_item} \n[${itemm.prix} pcs]`,
`${itemm.Icons}`
);
}
blocksui.show(player).then((res) => {
// Code here
});
}
});