Squirrel/Server/Functions/SpawnClass/Colour
From Liberty Unleashed Wiki
(Difference between revisions)
(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 == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | 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 === | ||
− | + | 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:
int SpawnClass.Colour
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
-- todo
Notes
-- Example notes/used functions here
Example 2. Setting
function onPlayerCommand( player, cmd, text ) { if ( cmd == "setcolour" ) { p_SpawnClass.Colour = 2; } }
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.