HUDClientChecked by LS:MP

getHudComponentPosition

GET_HUD_COMPONENT_POSITION0x223CA69A8C4417FD

The GTA V native GET_HUD_COMPONENT_POSITION of the HUD namespace, as LS:MP client scripts call it: the global function getHudComponentPosition, in JavaScript and in Lua.

SignatureJavaScript
getHudComponentPosition(id: number): { x: number, y: number, z: number }
SignatureLua
getHudComponentPosition(id: integer): Vector3

Usage

JavaScript
const { x, y, z } = getHudComponentPosition(id);
Lua
local coords = getHudComponentPosition(id)
-- coords.x, coords.y, coords.z

Parameters

ParameterTypeJavaScriptLua
idintnumberinteger

Returns

Vector3 JavaScript { x: number, y: number, z: number }, Lua Vector3

A 3D vector. JavaScript gets a plain { x, y, z } object; Lua gets a real Vector3, with .x .y .z and arithmetic. As an argument, one vector fills three consecutive coordinates.

On LS:MP

ℹ
Checked by LS:MP

id must be between 0 and 160. Otherwise the call is ignored and returns a zero vector: nothing reaches the game, and no error is raised.

Reference

Namespace
HUD HUD
In the game
Vector3 GET_HUD_COMPONENT_POSITION(int id)
Hash
0x223CA69A8C4417FD

Open in the interactive natives reference