PedClientChecked by LS:MP1 output

getPedNearbyVehicles

GET_PED_NEARBY_VEHICLES0xCFF869CBFA210D82

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

SignatureJavaScript
getPedNearbyVehicles(ped: Ped): [result: number, sizeAndVehs: number[]]
SignatureLua
getPedNearbyVehicles(ped: Ped): integer, integer[]

Usage

JavaScript
const [result, sizeAndVehs] = getPedNearbyVehicles(ped);
Lua
local result, sizeAndVehs = getPedNearbyVehicles(ped)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger

Returns

2 values, in this order: an array in JavaScript, multiple return values in Lua.

#ValueTypeJavaScriptLuaDescription
1resultintnumberintegerThe native’s own return value.
2sizeAndVehsEntityListnumber[]integer[]output

On LS:MP

ℹ
Vehicle handles

Pass a valid ped handle. Returns the count followed by up to 256 nearby vehicle handles from the ped scanner.

ℹ
GTA V Enhanced 1158.16

This LS:MP adapter is available on Enhanced 1158.16. Calls on another build raise an error.

ℹ
Checked by LS:MP

sizeAndVehs is required. Otherwise the call is ignored and returns 0: nothing reaches the game, and no error is raised.

Reference

Namespace
Ped PED
In the game
int GET_PED_NEARBY_VEHICLES(Ped ped, EntityList* sizeAndVehs)
Hash
0xCFF869CBFA210D82

Open in the interactive natives reference