CreateHorse
Puts a horse in the world.
controllerPid is the player whose client simulates it (usually the one it is for); with nil nobody does and it stands
still until the server hands it to the nearest player within 30 m. world is the virtual world (nil = the controller’s;
0 without one). soul is the breed - a Horse-archetype soul by name (Horse2, Pebbles), id or GUID from
the horse souls; nil = the server’s [spawn] horse_soul; a key that is not a horse makes no horse.
nil when the world is full ([world] max_entities).
Syntax
Section titled “Syntax”CreateHorse(x, y, z, yaw [, controllerPid, world, soul])| Parameter | Type | |
|---|---|---|
x |
number | metres |
y |
number | metres |
z |
number | metres |
yaw |
number | degrees (0 without) |
controllerPid |
number | the player whose client simulates it; nil = nobody yet (optional) |
world |
number | the virtual world; nil = the controller’s (optional) |
soul |
string | number | the breed - a horse soul’s name, id or GUID; nil = the server default (optional) |
Returns
Section titled “Returns”number - the horse’s entity id; nil when it could not be made
Example
Section titled “Example”-- /steed: a horse in front of the player, mounted at oncelocal x, y, z = GetPlayerPos(pid)local r = math.rad(GetPlayerYaw(pid))local horse = CreateHorse(x - math.sin(r) * 3, y + math.cos(r) * 3, z, GetPlayerYaw(pid), pid, nil, "Pebbles")if horse then MountPlayer(pid, horse) endSee also
Section titled “See also”MountPlayer · GetPlayerHorse · GetHorseSoul · DestroyEntity · the Horses group of the index
