GetEntityDimension

From GT-MP
Jump to: navigation, search
GetEntityDimension
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

Gets the dimension of an entity.


Dialog-warning.png NOTE: Client-sided and server-sided dimensions are not synced. You will get different values if you set them seperately.

Syntax

API.getEntityDimension(NetHandle entity);

Required Arguments

  • entity: parameter input should be in NetHandle type.

NOTE: This function returns data in int type.

Usage example(s)

This command will display your current dimension.

In C#
Server-Side Function

[Command("dimension")]
public Dimension(Client player)
{
   int dimension = API.getEntityDimension(player);
   API.sendChatMessageToPlayer(player, "Your dimension is " + dimension);
}

This will spam the client of their current dimension.

In Javascript
Client-Side Function

API.onUpdate.connect(function () {
	var player = API.getLocalPlayer();
	var dimension = API.getEntityDimension();
	API.sendChatMessage("Your dimension is " + dimension);
});

References