Squirrel/Server/Functions/Checkpoints/Type

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example 2. Setting)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|Checkpoint.Type}}
 
This ''Checkpoint'' class member returns or sets the type of the checkpoint. [[Squirrel/Server/Constants#Marker_Types|Checkpoint type]] means how it can be hit (on foot, using a vehicle...). Defaults to MARKER_TYPE_BOTH.
 
This ''Checkpoint'' class member returns or sets the type of the checkpoint. [[Squirrel/Server/Constants#Marker_Types|Checkpoint type]] means how it can be hit (on foot, using a vehicle...). Defaults to MARKER_TYPE_BOTH.
  
 
== Syntax ==
 
== Syntax ==
 +
 
You can either return or set a new value using this member:
 
You can either return or set a new value using this member:
 
<code>int Checkpoint.Type</code>
 
<code>int Checkpoint.Type</code>
Line 9: Line 10:
 
== Arguments ==
 
== Arguments ==
  
* '''type''' - This is ID of the new [[Squirrel/Server/Constants#Marker_Types|type]].
+
* '''type''' - This is the new [[Squirrel/Server/Constants#Marker_Types|type]].
  
 
== Example 1. Returning ==
 
== Example 1. Returning ==
 +
 +
This example will message the player with the type ID for that checkpoint.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerFootCheckpointHit( player, checkpoint )
+
function onPlayerEnterCheckpoint( player, checkpoint )
 
{
 
{
MessagePlayer( "The current checkpoint type for this checkpoint is: " + checkpoint.Type, player );
+
    MessagePlayer( "The current checkpoint type for this checkpoint is: " + checkpoint.Type, player );
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 22: Line 27:
 
=== Notes ===
 
=== Notes ===
  
This example will message the player with the type ID for that checkpoint.
+
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 change the type of checkpoint to MARKER_TYPE_VEHICLE (only vehicles can enter it) when a player enters it.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function onPlayerFootCheckpointHit( player, checkpoint )
+
function onPlayerEnterCheckpoint( player, checkpoint )
 
{
 
{
checkpoint.Type = 2;
+
    checkpoint.Type = MARKER_TYPE_VEHICLE;
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 35: Line 44:
 
=== Notes ===
 
=== Notes ===
  
This example will change the type of checkpoint to ID 2 when a player enters it.
+
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:16, 24 September 2010

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

This Checkpoint class member returns or sets the type of the checkpoint. Checkpoint type means how it can be hit (on foot, using a vehicle...). Defaults to MARKER_TYPE_BOTH.

[edit] Syntax

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

  1. int Checkpoint.Type
  1. Checkpoint.Type = int type

[edit] Arguments

  • type - This is the new type.

[edit] Example 1. Returning

This example will message the player with the type ID for that checkpoint.

  1.  
  2. function onPlayerEnterCheckpoint( player, checkpoint )
  3. {
  4. MessagePlayer( "The current checkpoint type for this checkpoint is: " + checkpoint.Type, player );
  5. return 1;
  6. }
  7.  

[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 change the type of checkpoint to MARKER_TYPE_VEHICLE (only vehicles can enter it) when a player enters it.

  1.  
  2. function onPlayerEnterCheckpoint( player, checkpoint )
  3. {
  4. checkpoint.Type = MARKER_TYPE_VEHICLE;
  5. return 1;
  6. }
  7.  

[edit] Notes

The event onPlayerEnterCheckpoint was used in this example. More info about it in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox