PedClient

getPedExtractedDisplacement

GET_PED_EXTRACTED_DISPLACEMENT0xE0AF41401ADF87E3

The GTA V native GET_PED_EXTRACTED_DISPLACEMENT of the PED namespace, as LS:MP client scripts call it: the global function getPedExtractedDisplacement, in JavaScript and in Lua.

SignatureJavaScript
getPedExtractedDisplacement(
  ped: Ped,
  worldSpace: boolean
): { x: number, y: number, z: number }
SignatureLua
getPedExtractedDisplacement(ped: Ped, worldSpace: boolean): Vector3

Usage

JavaScript
const { x, y, z } = getPedExtractedDisplacement(ped, worldSpace);
Lua
local coords = getPedExtractedDisplacement(ped, worldSpace)
-- coords.x, coords.y, coords.z

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
worldSpaceBOOLbooleanboolean

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.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Gets the offset the specified ped has moved since the previous tick.

If worldSpace is false, the returned offset is relative to the ped. That is, if the ped has moved 1 meter right and 5 meters forward, it'll return 1,5,0.

If worldSpace is true, the returned offset is relative to the world. That is, if the ped has moved 1 meter on the X axis and 5 meters on the Y axis, it'll return 1,5,0.

Reference

Namespace
Ped PED
In the game
Vector3 GET_PED_EXTRACTED_DISPLACEMENT(Ped ped, BOOL worldSpace)
Hash
0xE0AF41401ADF87E3

Open in the interactive natives reference