Squirrel/Server/Functions/Spheres/Colour
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example 1. Returning) |
(i) |
||
Line 28: | Line 28: | ||
== Example 2. Setting == | == Example 2. Setting == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerFootSphereHit( player, sphere ) | |
+ | { | ||
+ | sphere.Colour = 1; | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This will set the sphere to colour 1 when it is hit. | ||
=== Notes === | === Notes === | ||
− | + | The call [[Squirrel/Server/Events/Player/onPlayerFootSphereHit|onPlayerFootSphereHit]] was used in in this example. More info about this in the corresponding page. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Spheres}} | {{Squirrel/Server/Functions/Spheres}} |
Revision as of 03:57, 8 March 2010
This Sphere class member returns or sets the colour ID of the sphere.
Syntax
You can either return or set a new value using this member:
int Sphere.Colour
Sphere.Colour = int newcol
Arguments
- newcol - This is the new colour for the sphere as an integer
Example 1. Returning
function onPlayerFootSphereHit( player, sphere ) { MessagePlayer( "This sphere currently has the colour: " + sphere.Colour, player ); }
This will message the player with the spheres colour when they hit it.
Notes
The call onPlayerFootSphereHit was used in in this example. More info about this in the corresponding page.
Example 2. Setting
function onPlayerFootSphereHit( player, sphere ) { sphere.Colour = 1; }
This will set the sphere to colour 1 when it is hit.
Notes
The call onPlayerFootSphereHit was used in in this example. More info about this in the corresponding page.