GetEntityPosition

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

This function returns given Entity Position in Vector3 type.


Syntax

API.getEntityPosition(NetHandle entity);

Required Arguments

  • entity: parameter input should be in NetHandle type.

NOTE: This function returns data in Vector3 type.

Usage example

#1 An example of a command that retrieves actual player's position and print it into in-game chat.

[Command("getpos")]
public void GetPosition(Client player)
{
    Vector3 PlayerPos = API.getEntityPosition(player);
    API.sendChatMessageToPlayer(player, "X: " + PlayerPos.X + " Y: " + PlayerPos.Y + " Z: " + PlayerPos.Z);
}

References