Squirrel/Server/Functions/Checkpoints/Radius
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example 2. Setting) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|Checkpoint.Radius}} | |
− | This ''Checkpoint'' class member returns or sets the radius of the | + | This ''Checkpoint'' class member returns or sets the radius of the checkpoint. |
== Syntax == | == Syntax == | ||
+ | |||
You can either return or set a new value for this member: | You can either return or set a new value for this member: | ||
<code>float Checkpoint.Radius</code> | <code>float Checkpoint.Radius</code> | ||
Line 12: | Line 13: | ||
== Example 1. Returning == | == Example 1. Returning == | ||
+ | |||
+ | This example will message the player with the current radius of the checkpoint. | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerEnterCheckpoint( player, checkpoint ) |
{ | { | ||
− | + | MessagePlayer( "The current radius of this checkpoint is: " + checkpoint.Radius, player ); | |
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> | ||
Line 22: | Line 27: | ||
=== Notes === | === Notes === | ||
− | + | 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 == | ||
+ | |||
+ | This example will increase the radius of the checkpoint by 1 unit every time a player enters it. | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerEnterCheckpoint( player, checkpoint ) |
{ | { | ||
− | + | checkpoint.Radius = checkpoint.Radius + 1.0; | |
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> | ||
Line 35: | Line 44: | ||
=== Notes === | === Notes === | ||
− | + | The event [[Squirrel/Server/Events/Marker/onPlayerEnterCheckpoint|onPlayerEnterCheckpoint]] was used in this example. More info about it in the corresponding page. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Checkpoints}} | {{Squirrel/Server/Functions/Checkpoints}} |
Latest revision as of 20:09, 24 September 2010
This Checkpoint class member returns or sets the radius of the checkpoint.
[edit] Syntax
You can either return or set a new value for this member:
float Checkpoint.Radius
Checkpoint.Radius = float fRadius
[edit] Arguments
- fRadius - This is the new radius of the checkpoint.
[edit] Example 1. Returning
This example will message the player with the current radius of the checkpoint.
function onPlayerEnterCheckpoint( player, checkpoint ) { MessagePlayer( "The current radius of this checkpoint is: " + checkpoint.Radius, player ); return 1; }
[edit] Notes
The function MessagePlayer and event onPlayerEnterCheckpoint were used in this example. More info about them in the corresponding pages.
[edit] Example 2. Setting
This example will increase the radius of the checkpoint by 1 unit every time a player enters it.
function onPlayerEnterCheckpoint( player, checkpoint ) { checkpoint.Radius = checkpoint.Radius + 1.0; return 1; }
[edit] Notes
The event onPlayerEnterCheckpoint was used in this example. More info about it in the corresponding page.