Squirrel/Server/Functions/Checkpoints/GetCheckpointCount

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
Line 20: Line 20:
 
         if ( command == "checkpoints" )
 
         if ( command == "checkpoints" )
 
         {
 
         {
                   local Checkpoints = GetCheckpointCount();
+
                   local checkpoints = GetCheckpointCount();
 
                   local PlrCheckpoints = GetCheckpointCount( player );
 
                   local PlrCheckpoints = GetCheckpointCount( player );
 
                    
 
                    
                   MessagePlayer( "There are currently " + Checkpoints + " global checkpoints in-game.", player );
+
                   MessagePlayer( "There are currently " + checkpoints + " global checkpoints in-game.", player );
 
                   MessagePlayer( "There are also " + PlrCheckpoints + " checkpoints which belong to you!", player );
 
                   MessagePlayer( "There are also " + PlrCheckpoints + " checkpoints which belong to you!", player );
 
         }
 
         }

Revision as of 04:05, 8 March 2010

This function returns the number of checkpoints in the server. If the optional player argument is used, the function will return how many client-side checkpoints does the given player have. Without the argument it will return the number of global checkpoints.

Syntax

  1. int GetCheckpointCount( [ Player plr ] )

Arguments

  • plr - If you want to get the number of the checkpoints for a specific client, use this argument to indicate the player. If you don't use this argument the global checkpoint count will be returned

Example

  1.  
  2.  
  3. This example command returns the count of checkpoints ingame (global and local checkpoints).
  4. function onPlayerCommand( player, command, text )
  5. {
  6. if ( command == "checkpoints" )
  7. {
  8. local checkpoints = GetCheckpointCount();
  9. local PlrCheckpoints = GetCheckpointCount( player );
  10. MessagePlayer( "There are currently " + checkpoints + " global checkpoints in-game.", player );
  11. MessagePlayer( "There are also " + PlrCheckpoints + " checkpoints which belong to you!", player );
  12. }
  13. }
  14.  

Notes

The function MessagePlayer and event onPlayerCommand were used in in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox