Squirrel/Server/Functions/Pickups/GetPickupCount
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function returns the number of pickups on the server. == Syntax == <code>int GetPickupCount()</code> == Arguments == * '''none''' == Example == {{Squirrel/NeedsExample...) |
(→Example) |
||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( player, cmd, text ) | |
+ | { | ||
+ | if ( cmd == "pickupcount" ) | ||
+ | { | ||
+ | local pupcount = GetPickupCount( ); | ||
+ | |||
+ | if ( pupcount > 0 ) MessagePlayer( "There are currently: " + pupcount + " pickups!", player ); | ||
+ | else MessagePlayer( "There are no pickups", player ); | ||
+ | } | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This command will give the player information about the number of pickups in the server. | ||
=== Notes === | === Notes === | ||
− | + | The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Pickups}} | {{Squirrel/Server/Functions/Pickups}} |
Revision as of 03:15, 8 March 2010
This function returns the number of pickups on the server.
Syntax
int GetPickupCount()
Arguments
- none
Example
function onPlayerCommand( player, cmd, text ) { if ( cmd == "pickupcount" ) { local pupcount = GetPickupCount( ); if ( pupcount > 0 ) MessagePlayer( "There are currently: " + pupcount + " pickups!", player ); else MessagePlayer( "There are no pickups", player ); } }
This command will give the player information about the number of pickups in the server.
Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.