Squirrel/Server/Events/Player/onPlayerPart

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|onPlayerPart}}
This is called when a player leaves the server.
+
This is called when a player disconnects from the server.
  
 
== Syntax ==
 
== Syntax ==
Line 6: Line 6:
 
<code>function onPlayerPart( Player player, int reason )</code>
 
<code>function onPlayerPart( Player player, int reason )</code>
  
== Parameters ==
+
=== Arguments ===
  
 
* '''player''' - The pointer of the new player
 
* '''player''' - The pointer of the new player
 
* '''reason''' - The [[Squirrel/Server/Constants#Part_Reasons|reason ID]] for the part
 
* '''reason''' - The [[Squirrel/Server/Constants#Part_Reasons|reason ID]] for the part
 +
 +
=== Returns ===
 +
 +
This event does not handle return values.
  
 
== Example ==
 
== Example ==
  
This will say ''<name> left the server'' when a player leaves the server
+
This example will say ''<name> left the server'' when a player leaves the server.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
 
function onPlayerPart( player, reason )
 
function onPlayerPart( player, reason )
 
{
 
{
     Message( player.Name + " left the server" );
+
     Message( "* " + player.Name + " left the server" );
 
      
 
      
 
     return 1;
 
     return 1;
Line 26: Line 30:
 
=== 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/Message|Message]] 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:43, 22 December 2010

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

This is called when a player disconnects from the server.

[edit] Syntax

  1. function onPlayerPart( Player player, int reason )

[edit] Arguments

  • player - The pointer of the new player
  • reason - The reason ID for the part

[edit] Returns

This event does not handle return values.

[edit] Example

This example will say <name> left the server when a player leaves the server.

  1.  
  2. function onPlayerPart( player, reason )
  3. {
  4. Message( "* " + player.Name + " left the server" );
  5. return 1;
  6. }
  7.  

[edit] Notes

The functions Message 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