Squirrel/Server/Events/Player/onPlayerConnect

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 6: Line 6:
 
<code>function onPlayerConnect( Player player )</code>
 
<code>function onPlayerConnect( Player player )</code>
  
== Parameters ==
+
=== Arguments ===
  
 
* '''player''' - The pointer of the new player
 
* '''player''' - The pointer of the new player
 +
 +
=== Returns ===
 +
 +
This event does not handle return values.
  
 
== Example ==
 
== Example ==
  
This will PM ''Welcome to the server'' when a player joins the server
+
This will PM ''Welcome to the server'' when a player connects the server.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
 
function onPlayerConnect( player )
 
function onPlayerConnect( player )
 
{
 
{
     MessagePlayer( "Welcome to the server", player, 255, 0, 0 );
+
     MessagePlayer( "Welcome to the server!", player, 255, 0, 0 );
 +
   
 +
    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 function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] was used in this example. More info about it in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Events/Player}}
 
{{Squirrel/Server/Events/Player}}

Latest revision as of 18:55, 22 December 2010

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

This is called when a player connects to the server. This is fired before files and data has been sent to the client.

[edit] Syntax

  1. function onPlayerConnect( Player player )

[edit] Arguments

  • player - The pointer of the new player

[edit] Returns

This event does not handle return values.

[edit] Example

This will PM Welcome to the server when a player connects the server.

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

[edit] Notes

The function MessagePlayer was used in this example. More info about it in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox