Squirrel/Server/Functions/Checkpoints/Colour
From Liberty Unleashed Wiki
(Difference between revisions)
m (Typos (stupid copypasting ><)) |
|||
Line 27: | Line 27: | ||
=== Notes === | === Notes === | ||
− | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Marker/onPlayerEnterCheckpoint|onPlayerEnterCheckpoint]] were used | + | The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Marker/onPlayerEnterCheckpoint|onPlayerEnterCheckpoint]] were used in this example. More info about them in the corresponding pages. |
== Example 2. Setting == | == Example 2. Setting == |
Revision as of 19:56, 24 September 2010
This Checkpoint class member returns or sets the colour of the checkpoint.
Syntax
You can either return or set a new value using this member:
Colour Checkpoint.Colour
Checkpoint.Colour = Colour col
Arguments
- col - This is the pointer to a pre-defined RGB colour object.
Example 1. Returning
This example will message the player with the current RGB colour of the checkpoint.
function onPlayerEnterCheckpoint( player, checkpoint ) { local col = checkpoint.Colour; MessagePlayer( format( "The current RGB colour of this checkpoint is: %i, %i, %i", col.r, col.g, col.b ), player ) return 1; }
Notes
The function MessagePlayer and event onPlayerEnterCheckpoint were used in this example. More info about them in the corresponding pages.
Example 2. Setting
This example will turn the checkpoint red when a player enters it.
function onPlayerEnterCheckpoint( player, checkpoint ) { checkpoint.Colour = Colour( 255, 0, 0 ); return 1; }
Notes
The function MessagePlayer and event onPlayerEnterCheckpoint were used in in this example. More info about them in the corresponding pages.