为什么playerEnterColshapeHandler不起作用?

时间:2018-06-20 19:44:53

标签: javascript

我无法运行本主题中提到的功能。我没有很多js专家的朋友,所以我需要您的帮助。谢谢你们。 https://hastebin.com/bocuratige.js

const DB = require("../database");

const house = [];

阶级房屋{     构造函数(Id){

    mp.characters.getHouseInfo(Id).then((HouseInfo) => {
        console.log(HouseInfo);
        if (HouseInfo) {
            this.SqlId = HouseInfo.Id;
            console.log(this.SqlId);
            this.Owner = HouseInfo.Owner;
            this.Interior = HouseInfo.Interior;
            this.Locked = HouseInfo.Locked;
            this.Money = HouseInfo.Money;
            this.HouseExitDimension = HouseInfo.HouseExitDimension;
            this.PosX = HouseInfo.PosX;
            this.PosY = HouseInfo.PosY;
            this.PosZ = HouseInfo.PosZ;
            this.Price = HouseInfo.Price;
            this.ForSale = HouseInfo.ForSale;

            this.enterColShape = mp.colshapes.newSphere(this.PosX, this.PosY, this.PosZ, 1);
            this.enterColShape.setVariable("House_ID", this.SqlId);

            function playerEnterColshapeHandler(player, shape) {
                if (shape == this.enterColShape) {
                    player.HouseMarker_Id = this.SqlId;
                    console.log(`${player.name} entered the colshape` + shape.getVariable("House_ID"));
                }
            }

            function playerExitColshapeHandler(player, shape) {
                if(shape == this.enterColShape) {
                    this.setVariable("House_ID", null);
                }
              }

            mp.events.add("playerEnterColshape", playerEnterColshapeHandler);
            mp.events.add("playerExitColshape", playerExitColshapeHandler);

            this.marker = mp.markers.new(29, new mp.Vector3(this.PosX, this.PosY, this.PosZ), 1, {
                color: [255, 255, 255, 255],
                visible: true,
            });
            console.log(this.SqlId + " idli ev yaratıldı.");
        }
    });

}

}

DB.Connect(()=> {     DB.Pool.query(“ SELECT * FROM house;”,(错误,行)=> {         如果(err)console.log([Seven Init Error] ${err.message});         rows.forEach(element => {             var house = new House(element.Id);             house.push(house);         });     }); });

exports.House =房子;

0 个答案:

没有答案