getRandomPedAtCoord
GET_RANDOM_PED_AT_COORD0x876046A8E3A4B71CThe GTA V native GET_RANDOM_PED_AT_COORD of the PED namespace, as LS:MP client scripts call it: the global function getRandomPedAtCoord, in JavaScript and in Lua.
getRandomPedAtCoord(
x: number,
y: number,
z: number,
xRadius: number,
yRadius: number,
zRadius: number,
pedType: number
): PedgetRandomPedAtCoord(
x: number,
y: number,
z: number,
xRadius: number,
yRadius: number,
zRadius: number,
pedType: integer
): PedUsage
JavaScript
const ped = getRandomPedAtCoord(x, y, z, xRadius, yRadius, zRadius, pedType);Lua
local ped = getRandomPedAtCoord(x, y, z, xRadius, yRadius, zRadius, pedType)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
JavaScript · with vectors
const ped = getRandomPedAtCoord(pos, radius, pedType);Lua · with vectors
local ped = getRandomPedAtCoord(pos, radius, pedType)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
x | float | number | number |
y | float | number | number |
z | float | number | number |
xRadius | float | number | number |
yRadius | float | number | number |
zRadius | float | number | number |
pedType | int | number | integer |
Returns
Ped JavaScript number, Lua integerGame handle of a ped. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Gets a random ped in the x/y/zRadius near the x/y/z coordinates passed.
Ped Types:
Any = -1
Player = 1
Male = 4
Female = 5
Cop = 6
Human = 26
SWAT = 27
Animal = 28
Army = 29
Reference
- Namespace
- Ped PED
- In the game
Ped GET_RANDOM_PED_AT_COORD(float x, float y, float z, float xRadius, float yRadius, float zRadius, int pedType)- Hash
0x876046A8E3A4B71C