Squirrel/Server/Functions/SpawnClass/Skin

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This ''SpawnClass'' class member returns or sets the skin selected for the given spawn class. == Syntax == You can either return or set a new value using this member...)
 
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|SpawnClass.Skin}}
 
This ''SpawnClass'' class member returns or sets the [[SkinIDs|skin]] selected for the given spawn class.
 
This ''SpawnClass'' class member returns or sets the [[SkinIDs|skin]] selected for the given spawn class.
  
Line 13: Line 13:
 
== Example 1. Returning ==
 
== Example 1. Returning ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "getskin" )
 +
{
 +
local skin = p_SpawnClass.Skin;
 +
MessagePlayer( "The current spawn class skin is: " + skin, player );
 +
}
 +
}
 
</code>
 
</code>
  
=== Notes ===
+
This example will return the skin of the spawn class, that we found earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]].
 
+
-- Example notes/used functions here
+
  
 
== Example 2. Setting ==
 
== Example 2. Setting ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "setskin" )
 +
{
 +
local skin;
 +
if ( text ) skin = text.tointeger();
 +
if ( skin ) p_SpawnClass.Skin = skin;
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This example will set the skin of the spawn class, that we found earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]].
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes/used functions here
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/SpawnClass}}
 
{{Squirrel/Server/Functions/SpawnClass}}

Latest revision as of 10:39, 11 October 2010

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

This SpawnClass class member returns or sets the skin selected for the given spawn class.

[edit] Syntax

You can either return or set a new value using this member:

  1. int SpawnClass.Skin
  1. SpawnClass.Skin = int skin

[edit] Arguments

  • skin - The new skin for the spawn class

[edit] Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "getskin" )
  5. {
  6. local skin = p_SpawnClass.Skin;
  7. MessagePlayer( "The current spawn class skin is: " + skin, player );
  8. }
  9. }
  10.  

This example will return the skin of the spawn class, that we found earlier in FindSpawnClass.

[edit] Example 2. Setting

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setskin" )
  5. {
  6. local skin;
  7. if ( text ) skin = text.tointeger();
  8. if ( skin ) p_SpawnClass.Skin = skin;
  9. }
  10. }
  11.  

This example will set the skin of the spawn class, that we found earlier in FindSpawnClass.

[edit] Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox