GET_CLOSEST_PED
Gets the closest ped in a radius.
Hash
0xC33AB876A77F8164Runtime name
GetClosestPedNamespacePED
SideClient
NameOfficial
Docs
Since build1207
GTA V hash
0xC33AB876A77F8164Signature
BOOL GET_CLOSEST_PED(float x, float y, float z, float radius, BOOL p4, BOOL p5, Ped* outPed, BOOL p7, BOOL p8, BOOL p9, int pedType);Parameters
| Name | Type | Description |
|---|---|---|
x | float | — |
y | float | — |
z | float | — |
radius | float | — |
p4 | BOOL | — |
p5 | BOOL | — |
outPed | Ped* | — |
p7 | BOOL | — |
p8 | BOOL | — |
p9 | BOOL | — |
pedType | int | — |
Returns BOOL
Description
Gets the closest ped in a radius.
Usage
local retval, outPed = GetClosestPed(x, y, z, radius, p4, p5, p7, p8, p9, pedType)
-- always works, by hash
local retval, outPed = Citizen.InvokeNative(0xC33AB876A77F8164, x, y, z, radius, p4, p5, Citizen.PointerValueInt(), p7, p8, p9, pedType, Citizen.ReturnResultAnyway())JavaScript and C#
const [retval, outPed] = GetClosestPed(x, y, z, radius, p4, p5, p7, p8, p9, pedType);
// by hash
const [retval, outPed] = Citizen.invokeNative('0xC33AB876A77F8164', x + 0.0000001, y + 0.0000001, z + 0.0000001, radius + 0.0000001, p4, p5, Citizen.pointerValueInt(), p7, p8, p9, pedType, Citizen.returnResultAnyway());var outPed = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0xC33AB876A77F8164, x, y, z, radius, p4, p5, outPed, p7, p8, p9, pedType);
// outPed.GetResult<int>()- Float parameters: Lua integers (
10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write10.0orvalue + 0.0. The generated JS wrappers add0.0000001to non-zero floats for the same reason. - Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.
Sources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.