Squirrel/Client/Events/Player/onPlayerSpawn

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Added an example.)
(Fixed a broken example)
 
Line 4: Line 4:
 
== Syntax ==
 
== Syntax ==
  
<code>function onPlayerSpawn( player, class )</code>
+
<code>function onPlayerSpawn( player, spawn )</code>
  
 
=== Arguments ===
 
=== Arguments ===
  
 
* '''player''' - The pointer to the player that left
 
* '''player''' - The pointer to the player that left
* '''class''' - The pointer to the class they spawned as
+
* '''spawn''' - The pointer to the class they spawned as
  
 
=== Returns ===
 
=== Returns ===
Line 19: Line 19:
 
This example outputs your skin ID when you spawn.
 
This example outputs your skin ID when you spawn.
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerSpawn( player, class )
+
function onPlayerSpawn( player, spawn )
 
{
 
{
 
// Get the classes skin ID and save it as 'skin'
 
// Get the classes skin ID and save it as 'skin'
local skin = class.Skin;
+
local skin = spawn.Skin;
 
 
 
// Output their new skin
 
// Output their new skin

Latest revision as of 20:06, 14 October 2012

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

This event is called when a remote player spawns

[edit] Syntax

  1. function onPlayerSpawn( player, spawn )

[edit] Arguments

  • player - The pointer to the player that left
  • spawn - The pointer to the class they spawned as

[edit] Returns

This event does not handle return values.

[edit] Example

This example outputs your skin ID when you spawn.

  1.  
  2. function onPlayerSpawn( player, spawn )
  3. {
  4. // Get the classes skin ID and save it as 'skin'
  5. local skin = spawn.Skin;
  6. // Output their new skin
  7. Message( "* You have just spawned as skin " + skin + ".", 0, 255, 0 );
  8. return 1;
  9. }
  10.  

[edit] Notes

-- List of used functions and other notes here.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox