OnPlayerJoin: Difference between revisions
Jump to navigation
Jump to search
Update Lua event reference |
Document Lua events available or improved from G1R:MP 0.1.2 |
||
| Line 1: | Line 1: | ||
= onPlayerJoin = | = onPlayerJoin = | ||
Triggered after a client has | <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 event 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> | |||
Triggered after a client is authenticated and has received its authoritative player ID. | |||
== Availability == | == Availability == | ||
| Line 27: | Line 31: | ||
== Notes == | == Notes == | ||
* The player may still be loading the game world; use [[onPlayerChatReady]] for chat UI readiness. | * This callback runs before the client is required to send its first valid pawn snapshot. The player may therefore still be loading the game world; use [[onPlayerChatReady]] for chat UI readiness. | ||
* Calling <code>spawnPlayer</code>, <code>teleportPlayer</code>, or <code>setPlayerPosition</code> here may return <code>true</code> and queue the authoritative position request until the first valid snapshot proves that the pawn is ready. | |||
* A successful queue operation is not completion: [[onPlayerSpawn]] or [[onPlayerTeleport]] is emitted only after the client applies the reliable position-control command and the server accepts its acknowledgement. | |||
[[Category:Lua Events]] | [[Category:Lua Events]] | ||
[[Category:Server Events]] | [[Category:Server Events]] | ||
[[Category:Player Events]] | [[Category:Player Events]] | ||
Latest revision as of 18:41, 3 September 2026
onPlayerJoin
IMPROVED FROM UPDATE 0.1.2
This event 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.
Triggered after a client is authenticated and has received its authoritative player ID.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerJoin(playerId)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The authoritative ID assigned to the joining player. |
Examples
Handle the event:
addEventHandler("onPlayerJoin", root, function(playerId)
outputChatBox("Welcome to the server!", playerId, 225, 195, 110)
end)
Notes
- This callback runs before the client is required to send its first valid pawn snapshot. The player may therefore still be loading the game world; use onPlayerChatReady for chat UI readiness.
- Calling
spawnPlayer,teleportPlayer, orsetPlayerPositionhere may returntrueand queue the authoritative position request until the first valid snapshot proves that the pawn is ready. - A successful queue operation is not completion: onPlayerSpawn or onPlayerTeleport is emitted only after the client applies the reliable position-control command and the server accepts its acknowledgement.