用户:
ABS寄予清风NotFound查看:35 回复:6 评论:35 创建时间:2020-02-24T17:52:21
function isAdmin(playerName) {if (['送寒声'].indexOf(playerName) !== -1) {return true;} else {return false;}}
world.onPlayerJoin(({entity}) => {
world.say(entity.player.name + '\n欢迎来到~')
entity.player.enableDamage = true
entity.player.showHealthBar = true
entity.player.dam = 7.5
entity.player.maxHp = 200
entity.player.hp = 175
entity.player.enableActionA = true
if (isAdmin(entity.player.name)) {
entity.player.canFly = true
}
world.onPress(({button, raycast:{hitEntity, direction}}) =>{
if (!button !== 'action0' && !action0Button || !hitEntity || isAdmin(hitEntity.player.name)) {
return;
}
hitEntity.player.velocity.x += direction.x
hitEntity.player.velocity.y += 0.5
hitEntity.player.velocity.z += direction.z
hitEntity.hurt(entity.dam, {
attacker: entity,
})
})
})
world.onChat(({entity, message}) => {
if(entity.isPlayer) {
if (isAdmin(entity.player.name)) {
if (message === 'cq1') {
entity.player.spectator = true
} else if (message === 'cq0') {
entity.player.spectator = false
}
}
}
})
world.onDie(({entity, attacker}) => {
(async function() {
if (attacker) {
world.say(attacker.player.name + ' 击杀了 ' + entity.player.name)
}
await sleep(75000)
entity.player.forceRespawn()
})()
})
world.querySelectorAll('.test').enableDamage = true;
哪个大神检查一下错误?
检查不出······
感谢shyfcka!
代码已经没有错误了!
function isAdmin(playerName) {if (['送寒声'].indexOf(playerName) !== -1) {return true;} else {return false;}}
world.onPlayerJoin(({entity}) => {
world.say(entity.player.name + '\n欢迎来到~')
entity.player.enableDamage = true
entity.player.showHealthBar = true
entity.player.dam = 7.5
entity.player.maxHp = 200
entity.player.hp = 175
entity.player.enableActionA = true
if (isAdmin(entity.player.name)) {
entity.player.canFly = true
}
world.onPress(({button, raycast:{hitEntity, direction}}) =>{
if (!button !== 'action0Button' || !hitEntity || isAdmin(hitEntity.player.name)) {
return;
}
hitEntity.player.velocity.x += direction.x
hitEntity.player.velocity.y += 0.5
hitEntity.player.velocity.z += direction.z
hitEntity.hurt(entity.dam, {
attacker: entity,
})
})
})
world.onChat(({entity, message}) => {
if(entity && entity.isPlayer) {
if (isAdmin(entity.player.name)) {
if (message === 'cq1') {
entity.player.spectator = true
} else if (message === 'cq0') {
entity.player.spectator = false
}
}
}
})
world.onDie(({entity, attacker}) => {
(async function() {
if (attacker) {
world.say(attacker.player.name + ' 击杀了 ' + entity.player.name)
}
await sleep(75000)
entity.player.forceRespawn()
})()
})
world.querySelectorAll('.test').forEach((e) => e.enableDamage = true)点赞0
评论