CreateCart
Puts a free cart in the world - a wagon with its two horses or a two-wheeler with one, standing until a player takes the reins.
kind is the cart’s kind - "wagon" (nil or "" too) or "cart", the two-wheeler. z below 0 or nil = on the ground.
world is the virtual world (nil = 0). parts is what it looks like, as SetCartParts takes it - a slot left
out, or a part the server does not know (a line in the log), is the default. nil when carts are off
([carts] enabled), the kind is unknown or the world is full.
Syntax
Section titled “Syntax”CreateCart(x, y [, kind, z, yaw, world, parts])| Parameter | Type | |
|---|---|---|
kind |
string | "wagon" or "cart"; nil = "wagon" (optional) |
x |
number | metres - the front axle’s point (on a two-wheeler, where its horse stands) |
y |
number | metres |
z |
number | metres; nil or below 0 = on the ground (optional) |
yaw |
number | degrees, the way it faces (0 = +Y) (optional) |
world |
number | the virtual world; nil = 0 (optional) |
parts |
table | {body =, axle =, wheels =, load =, horse1 =, horse2 =} - any of the kind’s slots; nil = the default cart (optional) |
Returns
Section titled “Returns”number - the cart’s entity id; nil when it could not be made
Example
Section titled “Example”-- /wagon: a covered cart full of sacks for the player, across their way four metres aheadlocal x, y, z = GetPlayerPos(pid)local r = math.rad(GetPlayerYaw(pid))CreateCart("wagon", x - math.sin(r) * 4, y + math.cos(r) * 4, z, GetPlayerYaw(pid) + 90, nil, {body = "b_covered", axle = "b_covered", load = "sacks"})-- the peddler's two-wheeler behind a palominoCreateCart("cart", x + 5, y, z, 0, nil, {load = "market", horse1 = "palomino"})See also
Section titled “See also”DestroyEntity · SetCartParts · SetCartRoute · PutPlayerInCart · SetCartSpeed · the Carts group of the index
