SetPlayerPos
Moves the player’s game to a point - a teleport.
The client puts the player there on the next frame and the server’s record follows; reports from before the move are
dropped, so honest clients never trip the speed check. z below 0 puts the player on the terrain at x, y. A mounted
player is moved with the horse. Without yaw the player keeps their heading.
Syntax
Section titled “Syntax”SetPlayerPos(pid, x, y, z [, yaw])| Parameter | Type | |
|---|---|---|
pid |
number | the player |
x |
number | metres |
y |
number | metres |
z |
number | metres; below 0 = on the terrain |
yaw |
number | degrees to face (optional) |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”-- /goto <name>: next to another player, facing the same waylocal tx, ty, tz = GetPlayerPos(target)SetPlayerPos(pid, tx + 1.5, ty, tz, GetPlayerYaw(target))See also
Section titled “See also”GetPlayerPos · SpawnPlayer · SetEntityPos · the Players group of the index
