Entity::id: Difference between revisions
No edit summary |
ChronosX88 (talk | contribs) No edit summary |
||
| Line 2: | Line 2: | ||
This property is used for getting an entity ID. The ID is a unique identifier for the entity. | This property is used for getting an entity ID. The ID is a unique identifier for the entity. | ||
{{Note|A server-side ID is NOT the same as a client-side ID. Use [[ | {{Note|A server-side ID is NOT the same as a client-side ID. Use [[Entity::remoteId|remoteId]] property if you want it to match the server-side ID.}} | ||
==Getter== | ==Getter== | ||
Latest revision as of 20:55, 7 June 2020
This property is used for getting an entity ID. The ID is a unique identifier for the entity.
A server-side ID is NOT the same as a client-side ID. Use remoteId property if you want it to match the server-side ID.
Getter
- Int
Example
This event will log to the console the players name and the ID they have been assigned when joining the server.
Server-Side
mp.events.add("playerJoin", (player) => {
console.log(`${player.name} has joined. [${player.id}]`);
});