Squirrel/Server/Functions/Spheres/Radius

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This ''Sphere'' class member returns or sets the radius of the given sphere. == Syntax == You can either return or set a new value for this member: <code>float Sphere.Radius</co...)
 
Line 13: Line 13:
 
== Example 1. Returning ==
 
== Example 1. Returning ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerFootSphereHit( player, sphere )
 +
{
 +
MessagePlayer( "The current radius of this sphere is: " + sphere.Radius, player )
 +
}
 
</code>
 
</code>
  
=== Notes ===
+
This example will message the player with the current radius of the sphere.
 
+
-- Example notes/used functions here
+
  
 
== Example 2. Setting ==
 
== Example 2. Setting ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerFootSphereHit( player, sphere )
 +
{
 +
sphere.Radius += 1;
 +
}
 
</code>
 
</code>
 +
 +
This example will increase the radius of the sphere by 1 every time a player enters it.
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes/used functions here
+
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:11, 8 March 2010

This Sphere class member returns or sets the radius of the given sphere.

Syntax

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

  1. float Sphere.Radius
  1. Sphere.Radius = float fRadius

Arguments

  • fRadius - This is the new radius of the sphere.

Example 1. Returning

  1.  
  2. function onPlayerFootSphereHit( player, sphere )
  3. {
  4. MessagePlayer( "The current radius of this sphere is: " + sphere.Radius, player )
  5. }
  6.  

This example will message the player with the current radius of the sphere.

Example 2. Setting

  1.  
  2. function onPlayerFootSphereHit( player, sphere )
  3. {
  4. sphere.Radius += 1;
  5. }
  6.  

This example will increase the radius of the sphere by 1 every time a player enters it.

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox