CreatePed
Docslocal retval = CreatePed(pedType, modelHash, x, y, z, heading, isNetwork, bScriptHostPed)Description
Creates a ped (biped character, pedestrian, actor) with the specified model at the specified position and heading.
This ped will initially be owned by the creating script as a mission entity, and the model should be loaded already
(e.g. using REQUEST_MODEL).
Parameters
| Name | Type | Description |
|---|---|---|
pedType | int | Unused. Peds get set to CIVMALE/CIVFEMALE/etc. no matter the value specified. |
modelHash | Hash | The model of ped to spawn. |
x | float | Spawn coordinate X component. |
y | float | Spawn coordinate Y component. |
z | float | Spawn coordinate Z component. |
heading | float | Heading to face towards, in degrees. |
isNetwork | BOOL | Whether to create a network object for the ped. If false, the ped exists only locally. |
bScriptHostPed | BOOL | Whether to register the ped as pinned to the script host in the R\* network model. |
Quick Snippet: Get Coordinatesxyzheading
xyzheadingAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Get Ped Handle→ Ped
→ PedUse this to get the player ped handle for this native.
-- Get the player's ped handle (client-side)
local ped = PlayerPedId()
print("Ped handle: " .. ped)
-- For a specific player's ped (server-side):
-- local targetPed = GetPlayerPed(source)Quick Snippet: Load Model HashmodelHash
modelHashModels must be loaded before use. This snippet handles requesting and releasing properly.
-- Properly load a model before spawning/using it
local modelName = "prop_barrel_01a" -- change to your model
local modelHash = GetHashKey(modelName)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
print("Model loaded: " .. modelName .. " (" .. modelHash .. ")")
-- Release when done:
-- SetModelAsNoLongerNeeded(modelHash)Ped Models

mp_m_freemode_01
player_zero
ig_agatha
s_m_y_cop_01
s_m_m_gaffer_01
g_m_m_armboss_01
a_c_boar
a_m_m_bevhills_01Returns
PedReturns a ped (pedestrian) handle.