Squirrel/Server/Functions/Checkpoints/GetCheckpointCount

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ 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 p...)
 
(Example)
Line 12: Line 12:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
+
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, command, text )
 +
{
 +
        if ( command == "checkpoints" )
 +
        {
 +
                  local Checkpoints = GetCheckpointCount();
 +
                  local PlrCheckpoints = GetCheckpointCount( player );
 +
                 
 +
                  MessagePlayer( "There are currently " + Checkpoints + " in-game.", player );
 +
                  MessagePlayer( "Of which " + PlrCheckpoints + " belong to you!", player );
 +
        }
 +
}
 
</code>
 
</code>
  

Revision as of 16:06, 7 January 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. function onPlayerCommand( player, command, text )
  3. {
  4. if ( command == "checkpoints" )
  5. {
  6. local Checkpoints = GetCheckpointCount();
  7. local PlrCheckpoints = GetCheckpointCount( player );
  8. MessagePlayer( "There are currently " + Checkpoints + " in-game.", player );
  9. MessagePlayer( "Of which " + PlrCheckpoints + " belong to you!", player );
  10. }
  11. }
  12.  

Notes

-- Example notes here

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox