fix unexpired object error

This commit is contained in:
hydrant
2021-05-09 23:30:29 +02:00
parent b5061fd555
commit 4b958b3846

View File

@@ -8,13 +8,22 @@ class RageEntity implements IEntity {
public __attachmentObjects: any[]; public __attachmentObjects: any[];
get id(): number { get id(): number {
if (!this.entity) { if (!this.entity || !this.exists()) {
return null; return null;
} }
return this.entity.id; return this.entity.id;
} }
exists() {
switch (this.entity.type) {
case "player":
return mp.players.exists(this.entity as PlayerMp);
case "vehicle":
return mp.vehicles.exists(this.entity as VehicleMp);
}
}
get attachments(): number { get attachments(): number {
var color = this.entity.getVariable("nametagColor"); var color = this.entity.getVariable("nametagColor");
if (!color) if (!color)