OnClientPlayerJoin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__
This event is when a player joins.
{{Client event}}
This event is triggered when the local player joins a server.


==Syntax==  
==Parameters==
<syntaxhighlight lang="lua">
''None''
void onClientPlayerJoin ( void )
</syntaxhighlight>


==Example==  
==Example==
This example does...
This client side script outputs some text to the player when he joins.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onPlayerJoin () --When the player joins
function onPlayerJoin ()                             -- When the player joins
showTextForPlayer ( source, 5000, 0, 0, 180, 1.5, "We be gangstas!" ) --Shows text for the player
outputChatBox("We be gangstas!", 255, 0, 0)   -- Show him some text
end
end
addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) --Event is triggered
addEventHandler ( "onClientPlayerJoin", getRootElement(), onPlayerJoin ) -- add the function as an event handler
</syntaxhighlight>
</syntaxhighlight>

Revision as of 17:03, 14 September 2007

This event is triggered when the local player joins a server.

Parameters

None

Example

This client side script outputs some text to the player when he joins.

function onPlayerJoin ()                              -- When the player joins
	outputChatBox("We be gangstas!", 255, 0, 0)   -- Show him some text
end
addEventHandler ( "onClientPlayerJoin", getRootElement(), onPlayerJoin )  -- add the function as an event handler