Skip to main content

PedCreateScriptless

This function was added in DSL 6

Description

Creates a ped without attaching it to the current script.

Create a ped in a similar way to PedCreateXYZ, but do not attach them to the current script.

Usually this function should not be used unless you have a good reason for it.

function PedCreateScriptless(model, x, y, z, heading) --[[ ... ]] end

Parameters

  • model: integer - The model ID of the ped to create.
  • x: number - The X coordinate where the ped will be created
  • y: number - The Y coordinate where the ped will be created
  • z: number - The Z coordinate where the ped will be created
  • heading: number - The heading (rotation) of the ped when created, in degrees.

Return Values

  • ped: integer - The created ped.

Example

if IsKeyBeingPressed('L') then
local randomId = math.random(2, 258)
local x, y, z = PlayerGetPosXYZ()
local heading = math.random(0, 360)
local ped = PedCreateScriptless(randomId, x, y, z, heading)
-- Do something with the created ped
end

See Also