Squirrel/Server/Functions/SpawnClass/Colour

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example 1. Returning)
 
Line 1: Line 1:
 +
{{DISPLAYTITLE:SpawnClass.Colour}}
 
__NOTOC__
 
__NOTOC__
 
This ''SpawnClass'' class member returns or sets the ID of the pre-defined colour (check content.xml) for the given spawn class.
 
This ''SpawnClass'' class member returns or sets the ID of the pre-defined colour (check content.xml) for the given spawn class.
Line 12: Line 13:
  
 
== Example 1. Returning ==
 
== Example 1. Returning ==
 +
 +
This example will return the colour of the spawn class, that we found earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]].
  
 
<code lang="squirrel">
 
<code lang="squirrel">
Line 24: Line 27:
 
</code>
 
</code>
  
This example will return the colour of the spawn class, that we found earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]].
+
=== Notes ===
 +
 
 +
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Example 2. Setting ==
 
== Example 2. Setting ==
 +
 +
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.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
Line 37: Line 44:
 
}
 
}
 
</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 ===

Latest revision as of 12:04, 12 March 2010


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

[edit] Syntax

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

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

[edit] Arguments

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

[edit] Example 1. Returning

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

  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.  

[edit] Notes

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

[edit] Example 2. Setting

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

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

[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