fix unexpired object error
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user