OnClientPlayerJoin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (not cancellable)
No edit summary
 
Line 16: Line 16:
outputChatBox("* " .. getPlayerName(source) .. " has joined the server")
outputChatBox("* " .. getPlayerName(source) .. " has joined the server")
end
end
addEventHandler("onClientPlayerJoin", getRootElement(), remotePlayerJoin)
addEventHandler("onClientPlayerJoin", root, remotePlayerJoin)
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 20:43, 30 October 2024

This event is triggered when a player joins a server. It is triggered for all players except the local player, as the local player joins the server before their client-side resources are started. It would also be possible for two players to join within a few seconds of each other and for the two players' scripts may not receive onClientPlayerJoin events as their scripts wouldn't have started yet.

This event is not cancellable.

Parameters

None

Source

The source of this event is the player that joined the server.

Example

function remotePlayerJoin()
	outputChatBox("* " .. getPlayerName(source) .. " has joined the server")
end
addEventHandler("onClientPlayerJoin", root, remotePlayerJoin)

See Also

Client player events


Client event functions