用户:
Coms查看:5 回复:7 评论:5 创建时间:2023-02-25T23:27:53
world.querySelectorAll('*').forEach(async (e)=>{ if (e.id == '模型名字'){ e.enableInteract = true; e.interactRadius = 2;// 互动距离 e.interactHint = 'id'; e.onInteract(async ({ entity }) =>{ const password = await entity.player.dialog({ type : Box3DialogType.INPUT, content : '阿巴阿巴', // 内容 title : '阿巴巴巴', // 题目 confirmText : '确定', // 输入框提示文本 placeholder : '阿巴阿巴阿巴', // 按钮文本 }) if (!password || password === null) return;
if (String(password) == '114514'){// 填密码 entity.player.directMessage('啊对对对'); entity.position.set(0, 0, 0)// 答对后传送到哪里(坐标 } else {
entity.player.directMessage('啊错错错') } }) }; }) 下期写恒光学院的椅子代码~)
world.querySelectorAll('*').forEach(async (e)=>{
if (e.id == '模型名字'){
e.enableInteract = true;
e.interactRadius = 2;// 互动距离
e.interactHint = 'id';
e.onInteract(async ({ entity }) =>{
const password = await entity.player.dialog({
type : Box3DialogType.INPUT,
content : '阿巴阿巴', // 内容
title : '阿巴巴巴', // 题目
confirmText : '确定', // 输入框提示文本
placeholder : '阿巴阿巴阿巴', // 按钮文本
})
if (!password || password === null) return;
if (String(password) == '114514'){// 填密码
entity.player.directMessage('啊对对对');
entity.position.set(0, 0, 0)// 答对后传送到哪里(坐标
} else {
entity.player.directMessage('啊错错错')
}
})
};
}) //下期写恒光学院的椅子代码~) 点赞0
评论
Coms纠正)
world.querySelectorAll('*').forEach(async (e)=>{// 扫遍所有模型
if (e.id == '阿巴阿巴'){// 模型id名字
e.enableInteract = true;
e.interactRadius = 2;
e.interactHint = '阿巴阿巴';// 题目
e.onInteract(async ({ entity }) =>{
const password = await entity.player.dialog({
type : Box3DialogType.INPUT,// 对话框形式
content : '请输入暗号~', // 内容
title : '阿巴巴巴阿巴', // 题目
confirmText : '确定', // 输入框提示文本
placeholder : '6', // 按钮文本
})
if (!password || password === null) return;// 按叉不会报错)
if (String(password) == '114514'){// 填密码
entity.player.directMessage('啊对对对');
entity.position.set(26, 46, 10)// 答对之后position.set哪里
} else {
entity.player.directMessage('啊错错错')// 给玩家私发消息
}
})
};
})
点赞0
评论