SetEntityController
Hands the simulation of an entity to a player, or to nobody.
The way a horse changes hands: the new controller’s client spawns and drives the real thing, the others see a puppet.
nil gives it to nobody - it stands still until the minder hands it to the nearest player. Refused while someone else
rides it.
A horse in a running pull-down (IsPlayerInPullDown) keeps its controller until the pull-down ends, about six and a half
seconds after it started: the call returns true and the hand-over is done then - unless the new controller has left by
then or the horse has another rider by then - and an order for the player who controls it meanwhile cancels the waiting one.
Syntax
Section titled “Syntax”SetEntityController(id, pid)| Parameter | Type | |
|---|---|---|
id |
number | the entity |
pid |
number | nil | the new controller; nil = nobody |
Returns
Section titled “Returns”boolean - false when refused
Example
Section titled “Example”SetEntityController(horse, pid)See also
Section titled “See also”GetEntityController · MountPlayer · the World entities group of the index
