Squirrel/Server/Events/Player/onPlayerJoin

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|onPlayerJoin}}
This is called when a player joins the server. This is fired ''after'' files and data has been sent to the client
+
This is called when a player joins the server. This is fired ''after'' files and data have been sent to the client
  
 
== Syntax ==
 
== Syntax ==
Line 6: Line 6:
 
<code>function onPlayerJoin( Player plr )</code>
 
<code>function onPlayerJoin( Player plr )</code>
  
== Parameters ==
+
=== Arguments ===
  
* '''plr''' - The pointer of the new player
+
* '''plr''' - The pointer of the player who joined
 +
 
 +
=== Returns ===
 +
 
 +
This event does not handle return values.
  
 
== Example ==
 
== Example ==
  
This will say ''Hello'' to the player when they join the server
+
This will say welcome to the player when they join the server.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
Line 18: Line 22:
 
{
 
{
 
     MessagePlayer( "Welcome " + player.Name + " to the server!", player );
 
     MessagePlayer( "Welcome " + player.Name + " to the server!", player );
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 23: Line 29:
 
=== Notes ===
 
=== Notes ===
  
The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] was used in in this example. More info about it in the corresponding page.
+
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Players/Name|Player.Name]] were used in this example. More info about them can be found in the corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Events/Player}}
 
{{Squirrel/Server/Events/Player}}

Latest revision as of 19:07, 22 December 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This is called when a player joins the server. This is fired after files and data have been sent to the client

[edit] Syntax

  1. function onPlayerJoin( Player plr )

[edit] Arguments

  • plr - The pointer of the player who joined

[edit] Returns

This event does not handle return values.

[edit] Example

This will say welcome to the player when they join the server.

  1.  
  2. function onPlayerJoin( player )
  3. {
  4. MessagePlayer( "Welcome " + player.Name + " to the server!", player );
  5. return 1;
  6. }
  7.  

[edit] Notes

The functions MessagePlayer and Player.Name were used in this example. More info about them can be found in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox