createRandomPed
CREATE_RANDOM_PED0xB4AC7D0CF06BFE8FThe GTA V native CREATE_RANDOM_PED of the PED namespace, as LS:MP client scripts call it: the global function createRandomPed, in JavaScript and in Lua.
createRandomPed(posX: number, posY: number, posZ: number): PedcreateRandomPed(posX: number, posY: number, posZ: number): PedUsage
JavaScript
const ped = createRandomPed(posX, posY, posZ);Lua
local ped = createRandomPed(posX, posY, posZ)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 = createRandomPed(pos);Lua · with vectors
local ped = createRandomPed(pos)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
posX | float | number | number |
posY | float | number | number |
posZ | float | number | number |
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.
vb.net
Dim ped_handle As Integer
With Game.Player.Character
Dim pos As Vector3 = .Position + .ForwardVector * 3
ped_handle = Native.Function.Call(Of Integer)(Hash.CREATE_RANDOM_PED, pos.X, pos.Y, pos.Z)
End WithCreates a Ped at the specified location, returns the Ped Handle.
Ped will not act until setPedAsNoLongerNeeded is called.
Reference
- Namespace
- Ped PED
- In the game
Ped CREATE_RANDOM_PED(float posX, float posY, float posZ)- Hash
0xB4AC7D0CF06BFE8F