Squirrel/Server/Functions/Checkpoints/CreateCheckpoint

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page)
 
Line 1: Line 1:
 +
{{Squirrel/Title|CreateCheckpoint}}
 +
This function creates a new global checkpoint (corona) visible for everyone and returns a pointer to it. If the creation was unsuccessful, the function will return ''null''.
 +
 
== Syntax ==
 
== Syntax ==
  
<code>CreateCheckpoint( vector, radius )</code>
+
''CreateCheckpoint'' can take 3 different lists of parameters:
 +
 
 +
<code>CreateCheckpoint( Vector pos, float radius, [ Colour col ] )</code>
 +
<code>CreateCheckpoint( Vector pos, float radius, [ int red, int green, int blue ] )</code>
  
__NOTOC__
 
 
== Arguments ==
 
== Arguments ==
  
* ''' x y z ''' - The Vector where you want the checkpoint to be created.
+
* '''pos''' - The position where you want the checkpoint to be created
* ''' radius ''' - The Radius of the checkpoint to be created.
+
* '''radius''' - The radius of the checkpoint to be created
 +
* '''col''' - The colour of the checkpoint as a Colour object. If no colour is used the checkpoint will default to red
 +
* '''red, green, blue''' - The colour of the checkpoint as separate RGB values
  
 
== Example ==
 
== Example ==
 +
 +
This command will create a checkpoint at the player's location.
 +
 
<code lang="squirrel">
 
<code lang="squirrel">
 
function onPlayerCommand( player, cmd, text )
 
function onPlayerCommand( player, cmd, text )
 
{
 
{
      if ( cmd == "createcheckpoint" )
+
    if ( cmd == "cp" )
      {
+
    {
              local pos = player.Pos;
+
          local pos = player.Pos;
              CreateCheckpoint( Vector( pos.x, pos.y, pos.z ), 1 );
+
          CreateCheckpoint( pos, 5.0 );
      }
+
    }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
 
This command will create a checkpoint at the player's location.
 
  
 
== Notes ==
 
== Notes ==

Revision as of 19:22, 24 September 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function creates a new global checkpoint (corona) visible for everyone and returns a pointer to it. If the creation was unsuccessful, the function will return null.

Syntax

CreateCheckpoint can take 3 different lists of parameters:

  1. CreateCheckpoint( Vector pos, float radius, [ Colour col ] )
  1. CreateCheckpoint( Vector pos, float radius, [ int red, int green, int blue ] )

Arguments

  • pos - The position where you want the checkpoint to be created
  • radius - The radius of the checkpoint to be created
  • col - The colour of the checkpoint as a Colour object. If no colour is used the checkpoint will default to red
  • red, green, blue - The colour of the checkpoint as separate RGB values

Example

This command will create a checkpoint at the player's location.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "cp" )
  5. {
  6. local pos = player.Pos;
  7. CreateCheckpoint( pos, 5.0 );
  8. }
  9. return 1;
  10. }
  11.  

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox