OnPlayerSpawn
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.