Skip to content

PutPlayerInCart

Sits a player in a cart.

seat is the one they get (nil = the first free one from the bench beside the reins on that is not locked; a seat given by number may be locked); 0 puts them at the reins of a free cart, their client driving it. A player farther away than the prompt reaches is put beside the cart first. Their game climbs in as it would at the prompt; OnPlayerEnterCart is not asked. A player in this cart already is moved to the seat, as SetPlayerCartSeat does. false when the seat is taken, the reins of a route cart are asked for, or the player or the cart is not in the world (or not in the same virtual world).

PutPlayerInCart(pid, id [, seat])
Parameter Type
pid number the player
id number the cart
seat number the seat (0 = at the reins); nil = the first free one (optional)

boolean

-- /ride: into the nearest cart
local cart = GetNearestEntity(pid, ENTITY_CART, 30)
if not (cart and PutPlayerInCart(pid, cart)) then SendClientMessage(pid, COLOR_RED, "No seat free near you.") end

RemovePlayerFromCart · GetPlayerCart · OnPlayerEnterCart · the Carts group of the index