Skip to main content

PedCreateXYZ

Description

Creates a character at the specified location.

The ped will be tied to the current script so that it is cleaned up when the script terminates, and will of course be returned for you to script with.

function PedCreateXYZ(id, x, y, z) --[[ ... ]] end

Parameters

  • id: integer - The ped's model ID.
  • x: number - The X coordinate of the location where the ped will be created.
  • y: number - The Y coordinate of the location where the ped will be created.
  • z: number - The Z coordinate of the location where the ped will be created.

Return Values

  • ped: integer - The ID of the created ped (Not the model ID).

Example

Spawn Algie (ID 4) at the specified coordinates

local ped = PedCreateXYZ(4, 12.3, 4.56, 15.5)