用户:
YDS尹子查看:31 回复:44 评论:31 创建时间:2020-08-09T17:13:39

//nc=n c
world.querySelectorAll(".findAdmin").forEach((finder) => {
finder.enableInteract = true;
finder.interactRadius = 8;
finder.interactHint = "玩家查找器";
finder.interactColor = new Box3RGBColor(1, 1, 1);
finder.onInteract(async ({ entity }) => {
const result = await entity.player.dialog({
title: '系统',
type: Box3DialogType.INPUT,
content: `全局玩家查询系统开启,你要查询哪个玩家?`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
placeholder: '请输入玩家名',
confirmText: '确认',
})
const findee = world.querySelector("." + result);
const resu=await entity.player.dialog({
title: '系统',
type: Box3DialogType.SELECT,
content: `找到玩家${findee.player.name}`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
lookEye: entity,
lookEyeOffset: new Box3Vector3(0, 30, 0),
lookTarget: findee,
options:["到他那里去","知道了"],
})
if(resu.index==0){
entity.position.set(findee.position.x,findee.position.y+2,findee.position.z)
}
findee.player.dialog({
title: '系统',
type: Box3DialogType.TEXT,
content: `你被${entity.player.name}查询了`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
})
})
})world.onPlayerJoin(({entity})=>{entity.addTag(entity.player.name)})
world.querySelectorAll(".玩家查找器").forEach((finder) => {
finder.enableInteract = true;
finder.interactRadius = 8;
finder.interactHint = "玩家查找器";
finder.interactColor = new Box3RGBColor(1, 1, 1);
finder.onInteract(async ({ entity }) => {
const result = await entity.player.dialog({
title: '系统',
type: Box3DialogType.INPUT,
content: `全局玩家查询系统开启,你要查询哪个玩家?`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
placeholder: '请输入玩家名',
confirmText: '确认',
})
const findee = world.querySelector("." + result);
try {
if (findee.isPlayer) {
const resu=await entity.player.dialog({
title: '系统',
type: Box3DialogType.SELECT,
content: `找到玩家${findee.player.name}`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
lookEye: entity,
lookEyeOffset: new Box3Vector3(0, 30, 0),
lookTarget: findee,
options:["到他那里去","知道了"],
})
if(resu.index==0){
entity.position.set(findee.position.x,findee.position.y+2,findee.position.z)
}
findee.player.dialog({
title: '系统',
type: Box3DialogType.TEXT,
content: `你被${entity.player.name}查询了`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
})
}
} catch(err) {
await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'找不到这个玩家!',
content:'无法查找此玩家'
})
}
})
})
改版代码,不会出错
点赞0
评论