API REFERENCE
CreateSpoofedPed
Creates a ped with spoofed creation semantics at the given position.
Syntax
local ped = ONYX.CreateSpoofedPed(pedType, modelHash, x, y, z, heading, isNetwork, scriptHostPed)Parameters
pedType(int) — Ped type id.modelHash(int) — Model hash of the ped.x, y, z(number) — World coordinates.heading(number) — Facing angle in degrees.isNetwork(boolean) — Create the ped as a networked entity.scriptHostPed(boolean) — Register the ped as owned by your script.
Return(s)
ped (int) — entity handle, 0 on failure.
Behavior
- Returns 0 instead of throwing when the model is invalid or the spawn point is blocked.
- The entity is local to your client until it is synced by the game.
Example(s)
local model = GetHashKey("a_m_y_skater_01")
local ped = ONYX.CreateSpoofedPed(4, model, 215.0, -920.0, 30.0, 90.0, true, true)
if ped == 0 then print("spawn failed") end