Squirrel/Server/Functions/Spheres/Type
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This ''Sphere'' class member returns or sets the type of the sphere. Sphere type means how it can be hit (on foot, using a vehicle...)....) |
|||
Line 13: | Line 13: | ||
== Example 1. Returning == | == Example 1. Returning == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerFootSphereHit( player, sphere ) | |
+ | { | ||
+ | MessagePlayer( "The current type for this sphere is: " + sphere.Type, player ); | ||
+ | } | ||
</code> | </code> | ||
− | + | This example will message the player with the type ID for that sphere. | |
− | + | ||
− | + | ||
== Example 2. Setting == | == Example 2. Setting == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerFootSphereHit( player, sphere ) | |
+ | { | ||
+ | sphere.Type = 2; | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This will change the spheres type to 2 when a player hits it. | ||
=== 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 04:14, 8 March 2010
This Sphere class member returns or sets the type of the sphere. Sphere type means how it can be hit (on foot, using a vehicle...). Defaults to MARKER_TYPE_BOTH.
Syntax
You can either return or set a new value using this member:
int Sphere.Type
Sphere.Type = int type
Arguments
- type - This is the ID of the new type
Example 1. Returning
function onPlayerFootSphereHit( player, sphere ) { MessagePlayer( "The current type for this sphere is: " + sphere.Type, player ); }
This example will message the player with the type ID for that sphere.
Example 2. Setting
function onPlayerFootSphereHit( player, sphere ) { sphere.Type = 2; }
This will change the spheres type to 2 when a player hits it.
Notes
The call onPlayerFootSphereHit was used in in this example. More info about this in the corresponding page.