Squirrel/Server/Functions/Checkpoints/GetCheckpointCount
From Liberty Unleashed Wiki
(Difference between revisions)
(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 == | ||
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | - | + | 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
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
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 ); } }
Notes
-- Example notes here