TeleportPlayer: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Document Lua APIs available or improved from G1R:MP 0.1.2 |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= teleportPlayer = | = teleportPlayer = | ||
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;"> | |||
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">IMPROVED FROM UPDATE 0.1.2</div> | |||
<div style="color:#111111; margin-top:0.25rem;">This function is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.2 and later. The contract below describes the updated behavior.</div> | |||
</div> | |||
Teleports a connected player to an authoritative world position. | Teleports a connected player to an authoritative world position. | ||
| Line 24: | Line 28: | ||
== Returns == | == Returns == | ||
Returns <code>true</code> when the teleport is accepted | Returns <code>true</code> when the teleport is accepted into the player's position-control queue; otherwise returns <code>false</code>. | ||
== Examples == | == Examples == | ||
| Line 34: | Line 38: | ||
== Notes == | == Notes == | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
* This is the explicit teleport alias of <code>setPlayerPosition</code> and emits <code>onPlayerTeleport</code>. | * This is the explicit teleport alias of <code>setPlayerPosition</code>. Calls made before the first valid movement snapshot, including from <code>onPlayerJoin</code>, remain queued until the native pawn is ready. | ||
* The server commits the transform and emits <code>onPlayerTeleport</code> only after the native client acknowledges that it applied the queued command. | |||
* Coordinates use metres and yaw uses degrees. | * Coordinates use metres and yaw uses degrees. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
[[Category:Spatial Functions]] | [[Category:Spatial Functions]] | ||
Latest revision as of 18:40, 3 September 2026
teleportPlayer
IMPROVED FROM UPDATE 0.1.2
This function is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.2 and later. The contract below describes the updated behavior.
Teleports a connected player to an authoritative world position.
Syntax
bool teleportPlayer(int playerId, number x, number y, number z [, number yaw = 0])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
x |
number |
yes | World X coordinate in metres. |
y |
number |
yes | World Y coordinate in metres. |
z |
number |
yes | World Z coordinate in metres. |
yaw |
number |
no | Optional actor yaw in degrees; defaults to 0. |
Returns
Returns true when the teleport is accepted into the player's position-control queue; otherwise returns false.
Examples
Teleport a player to an RP spawn point:
teleportPlayer(playerId, 125.5, -48.0, 3.25, 180)
Notes
- Available only in server-side resource scripts.
- This is the explicit teleport alias of
setPlayerPosition. Calls made before the first valid movement snapshot, including fromonPlayerJoin, remain queued until the native pawn is ready. - The server commits the transform and emits
onPlayerTeleportonly after the native client acknowledges that it applied the queued command. - Coordinates use metres and yaw uses degrees.