Skip to content

SetCartSeatLocked

Keeps a seat of a cart from the use key - or gives it back.

The cart’s prompt never hands a locked seat out and PutPlayerInCart without a seat skips it; the mode’s own seats still go there (PutPlayerInCart with the seat, SetPlayerCartSeat, a seat OnPlayerEnterCart returns). With seat 0 locked the bench’s prompt offers a seat instead of the reins - the driver is the mode’s choice. Whoever sits there already stays. The locks last as long as the cart.

SetCartSeatLocked(id, seat [, locked])
Parameter Type
id number the cart
seat number the seat (0 = at the reins)
locked boolean false unlocks it; nil = true (optional)

boolean - false when it is not a cart or there is no such seat

-- a merchant's cart: nobody takes the reins but its owner
local cart = CreateCart("wagon", 1250, 1093)
SetCartSeatLocked(cart, 0)
CART_OWNER[cart] = pid
-- (OnPlayerEnterCart: `if seat == 1 and CART_OWNER[id] == pid then return 0 end` seats the owner at the reins)

IsCartSeatLocked · OnPlayerEnterCart · SetPlayerCartSeat · the Carts group of the index