SpawnPlayer: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| Line 39: | Line 39: | ||
* Spawning changes position but does not implicitly revive a dead player. Call <code>revivePlayer</code> when the gamemode requires it. | * Spawning changes position but does not implicitly revive a dead player. Call <code>revivePlayer</code> when the gamemode requires it. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
[[Category:Spatial Functions]] | [[Category:Spatial Functions]] | ||
Revision as of 09:55, 15 August 2026
spawnPlayer
Places a connected player at an authoritative spawn position.
Syntax
bool spawnPlayer(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 | Spawn X coordinate in metres. |
y |
number |
yes | Spawn Y coordinate in metres. |
z |
number |
yes | Spawn Z coordinate in metres. |
yaw |
number |
no | Optional actor yaw in degrees; defaults to 0. |
Returns
Returns true when the spawn action is accepted and queued; otherwise returns false.
Examples
Spawn newly connected players at a fixed location:
addEventHandler("onPlayerJoin", root, function(playerId)
spawnPlayer(playerId, 12.0, 24.0, 2.0, 90)
end)
Notes
- Available only in server-side resource scripts.
- This function emits
onPlayerSpawnwhen accepted. - Spawning changes position but does not implicitly revive a dead player. Call
revivePlayerwhen the gamemode requires it.