Squirrel/Server/Functions/SpawnClass/Colour

From Liberty Unleashed Wiki
Revision as of 17:33, 8 March 2010 by Force (Talk | contribs)

Jump to: navigation, search

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

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

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

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