猫史档案馆


这是咋回事

用户:掩护我先走掩护我先走查看:6 回复:2 评论:6 创建时间:2021-10-17T12:41:24


我定义了tank函数,可他还是报错了

function tank() {
    entity.player.maxHp = 550
    entity.player.addWearable({
        bodypart:Box3BodyPart.RIGHT_HAND,
        mesh:'mesh/火箭筒(绿).vb',
        offset: new Box3Vector3(-0.3,-0.3,0),
        orientation: new Box3Quaternion(0,1,0,0).rotateZ(-Math.PI/2.7)
    })
}
world.onPlayerjoin(({ entity }) => {
    entity.player.tank()
})

TypeError:entity.player.tank is not a function 

at eval (

index.js:82,23

)


回复

上一页1 页 / 共 1下一页
Stephan轩Stephan轩

entity.player对象内又没有这个函数,而且你定义的tank里entity对象哪来的?

点赞0


评论


该账号已被封禁该账号已被封禁

function tank() {
    this.player.maxHp = 550;
    this.player.addWearable({
        bodypart:Box3BodyPart.RIGHT_HAND,
        mesh:'mesh/火箭筒(绿).vb',
        offset: new Box3Vector3(-0.3,-0.3,0),
        orientation: new Box3Quaternion(0,1,0,0).rotateZ(-Math.PI/2.7)
    });
};
world.onPlayerjoin(({entity:e}) => {tank().call(e)});

点赞0


评论