Squirrel/Server/Functions/SpawnClass/Colour

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This ''SpawnClass'' class member returns or sets the ID of the pre-defined colour (check content.xml) for the given spawn class. == Syntax == You can either return or set a new ...)
 
(Example 2. Setting)
Line 24: Line 24:
 
== Example 2. Setting ==
 
== Example 2. Setting ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "setcolour" )
 +
{
 +
p_SpawnClass.Colour = 2;
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This example will set the colour of the spawn class, that we found earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]], to predefined colour 2.
  
 
=== 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}}

Revision as of 17:26, 8 March 2010

This SpawnClass class member returns or sets the ID of the pre-defined colour (check content.xml) for the given spawn class.

Syntax

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

  1. int SpawnClass.Colour
  1. SpawnClass.Colour = int colourID

Arguments

  • colourID - This is the ID of the colour defined in content.xml

Example 1. Returning

This function needs an example. You can help us complete the wiki by writing one, or maybe even more :o
  1.  
  2. -- todo
  3.  

Notes

-- Example notes/used functions here

Example 2. Setting

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setcolour" )
  5. {
  6. p_SpawnClass.Colour = 2;
  7. }
  8. }
  9.  

This example will set the colour of the spawn class, that we found earlier in FindSpawnClass, to predefined colour 2.

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox