Squirrel/Client/Events/Player/onPlayerSpawn

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|onPlayerSpawn}} This event is called when a remote player spawns == Syntax == <code>function onPlayerSpawn( player, class )</code> === Arguments === * '''pla…')
 
(Added an example.)
Line 17: Line 17:
 
== Example ==
 
== Example ==
  
Some explanation here
+
This example outputs your skin ID when you spawn.
{{Squirrel/NeedsExample}}
+
 
+
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerSpawn( player, class )
 +
{
 +
// Get the classes skin ID and save it as 'skin'
 +
local skin = class.Skin;
 +
 +
// Output their new skin
 +
Message( "* You have just spawned as skin " + skin + ".", 0, 255, 0 );
 +
 +
return 1;
 +
}
 
</code>
 
</code>
  

Revision as of 23:52, 27 September 2011

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

This event is called when a remote player spawns

Syntax

  1. function onPlayerSpawn( player, class )

Arguments

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

Returns

This event does not handle return values.

Example

This example outputs your skin ID when you spawn.

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

Notes

-- List of used functions and other notes here.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox