用户:
幻想一笑而过查看:41 回复:19 评论:41 创建时间:2021-05-23T16:50:17
代码如下↓
//控制⾯板
world.onPlayerJoin(({ entity }) => { //玩家进⼊游戏时
entity.player.onPress(async ({ button }) => { //每当有按钮被按下
if (button == Box3ButtonType.ACTION1) { //如果按钮是右键
const selection = await entity.player.dialog({
type: Box3DialogType.SELECT, //对话框类型为选择框
content: `${entity.player.name}`,
title: `控制⾯板`,
options: ['幽灵模式', '管喵特权', '服务器强制崩溃重启'],
})
if (selection) { //确保对话框不是点击x关闭
if (selection.value === '幽灵模式') {
if (entity.player.name == '幻想一笑而过') {
entity.player.spectator = !entity.player.spectator;
} else {
entity.player.dialog({ //弹出对话框
type: Box3DialogType.TEXT, //对话框类型为纯⽂本
content: `你不是管喵`,
title: '系统',
})
}
}
if (selection.value === '服务器强制崩溃重启') {
if (entity.player.name === '幻想一笑而过') {
const selection = await entity.player.dialog({
type: Box3DialogType.SELECT, //对话框类型为选择框
content: `真的确定要重启服务器吗?`,
title: `控制⾯板`,
options: ['是', '否'],
})
if (selection) {
if (selection.value === '是') {
world.say('作者 幻想一笑而过 使用了while循环')
world.say('服务器已强制崩溃即将重启')
while(1){}
}
}
} else {
entity.player.dialog({ //弹出对话框
type: Box3DialogType.TEXT, //对话框类型为纯⽂本
content: `你不是管喵`,
title: '系统',
})
}
}
if (selection.value === '管喵特权') {
if (entity.player.name === '幻想一笑而过' || entity.player.name === '全息碎影孙悟空_' || entity.player.name === '战神_皮卡' || entity.player.name === '四十七师副营长') {
const code = await entity.player.dialog({ //弹出对话框
type: Box3DialogType.INPUT, //对话框类型为输入框
content: `请输入指令`,
title: '系统',
});
try {
world.say('~>' + eval(code));
} catch (err) {
world.say('⚠Error⚠:' + err);
}
} else {
entity.player.dialog({ //弹出对话框
type: Box3DialogType.TEXT, //对话框类型为纯⽂本
content: `你不是管喵`,
title: '系统',
})
}
}
}
}
})
});
以上代码包含3个功能
幽灵模式
强制令地图服务器崩溃重启
管喵直接使用代码
使用方法:
直接把以上代码复制粘贴到地图编辑器中
然后把所有出现“幻想一笑而过”的地方的内容改成你的名字
然后运行地图,右键就可以使用了
幻想一笑而过注
代码中
出现以下语句的地方
(entity.player.name === '幻想一笑而过' || entity.player.name === '全息碎影孙悟空_' || entity.player.name === '战神_皮卡' || entity.player.name === '四十七师副营长')
请把多余的
|| entity.player.name === '全息碎影孙悟空_' || entity.player.name === '战神_皮卡' || entity.player.name === '四十七师副营长'
删掉
只保留
(entity.player.name === '幻想一笑而过')点赞2
评论