OnPlayerSpawn

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:32, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onPlayerSpawn

Triggered after the server authoritatively spawns a player in the game world.

Availability

This event is available in server-side scripts.

Callback signature

onPlayerSpawn(playerId, x, y, z, yaw)

Parameters

Name Type Description
playerId int The affected player ID.
x number World X coordinate in metres.
y number World Y coordinate in metres.
z number World Z coordinate in metres.
yaw number World yaw in degrees.

Examples

Handle the event:

addEventHandler("onPlayerSpawn", root, function(playerId, x, y, z, yaw)
    outputDebugString("Spawned player " .. playerId .. " at " .. x .. ", " .. y .. ", " .. z)
end)

Notes

  • Coordinates use the public Lua API metre convention.