From aadf09acb2ae34949d41c4ff165b140482ca8458 Mon Sep 17 00:00:00 2001 From: xshady <54737754+xxshady@users.noreply.github.com> Date: Sun, 24 Dec 2023 01:42:28 +0300 Subject: [PATCH] Update rml nametags resource (#35) * Update rml nametags resource * Use BaseObject type+id instead of old entity id * Use getByRemoteID --- rml-nametags/Client/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rml-nametags/Client/main.js b/rml-nametags/Client/main.js index 8750126..3ea003e 100644 --- a/rml-nametags/Client/main.js +++ b/rml-nametags/Client/main.js @@ -24,15 +24,16 @@ let tickHandle = undefined; alt.on("gameEntityCreate", (entity) => { const rmlElement = document.createElement("button"); - rmlElement.id = entity.id.toString(); + rmlElement.entityType = entity.type; + rmlElement.entityID = entity.remoteID; rmlElement.addClass("nametag"); rmlElement.addClass("hide"); if (entity instanceof alt.Player) { if (showPlayerIds && !showPlayerNames) - rmlElement.innerRML = `ID: ${entity.id}`; + rmlElement.innerRML = `ID: ${entity.remoteID}`; else if (showPlayerIds && showPlayerNames) - rmlElement.innerRML = `ID: ${entity.id} | Name: ${entity.name}`; + rmlElement.innerRML = `ID: ${entity.remoteID} | Name: ${entity.name}`; else if (!showPlayerIds && showPlayerNames) rmlElement.innerRML = `Name: ${entity.name}`; else { @@ -40,7 +41,7 @@ alt.on("gameEntityCreate", (entity) => { return; } } else if (entity instanceof alt.Vehicle && showVehicleIds) - rmlElement.innerRML = `ID: ${entity.id}`; + rmlElement.innerRML = `ID: ${entity.remoteID}`; else { rmlElement.destroy(); return; @@ -82,7 +83,7 @@ alt.on("keyup", (key) => { }); function printCoordinates(rmlElement, eventArgs) { - const entity = alt.Entity.getByID(parseInt(rmlElement.id)); + const entity = alt.BaseObject.getByRemoteID(rmlElement.entityType, rmlElement.entityID); alt.log("Entity Position", "X", entity.pos.x, "Y", entity.pos.y, "Z", entity.pos.z); }