猫史档案馆


求助!!!

用户:ABS寄予清风NotFoundABS寄予清风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;

哪个大神检查一下错误?emotion_泪检查不出······


回复

上一页1 页 / 共 1下一页
ABS寄予清风NotFoundABS寄予清风NotFound

沙发(不要让我自己占好不好~)

点赞0


评论


面具狐狸云绾兮面具狐狸云绾兮

板凳

点赞0


评论


ZH-Y-QZH-Y-Q

这个是做什么的

点赞2


评论


芜湖咸鱼芜湖咸鱼

能说的清楚一点吗

点赞0


评论


芜湖咸鱼芜湖咸鱼

没有检查出语法错误

点赞0


评论


ABS寄予清风NotFoundABS寄予清风NotFound

感谢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


评论