SpawnPlayer

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 20:14, 5 August 2026 by QCherry (talk | contribs) (Automatyczna aktualizacja dokumentacji funkcji)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 onPlayerSpawn when accepted.
  • Spawning changes position but does not implicitly revive a dead player. Call revivePlayer when the gamemode requires it.