用户:
屑羽yee查看:7 回复:11 评论:7 创建时间:2022-12-20T15:33:24
代码如下↓
entity.player.onPress(async ({ button }) => { //每当有按钮被按下
if (button == Box3ButtonType.ACTION1) { //如果按钮是右键
const hd = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `控制面板`,
content:`切换音乐`,
options: ['只因你太美', '曹坤'],//选项
});
if (hd == null || !hd ) return;
if (hd.index == 0){//当玩家选择了选项1
entity.player.sample = 'audio/只因你太美.mp3';
other.player.directMessage('切换成功') // 给玩家发消息
}
else if (hd.index == 1){//当玩家选择了选项2
entity.player.sample = 'audio/曹坤.mp3';
other.player.directMessage('切换成功') // 给玩家发消息
}
}
})
world.onPlayerJoin(({ entity }) => {
// 默认音乐()
entity.player.sample = 'audio/只因你太美.mp3';
//entity.player.kick();eee可以逝世()
})