Squirrel/Server/Functions/Vehicles/GetVehicleCount

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|GetVehicleCount}}
 
This function returns the number of vehicles ingame.
 
This function returns the number of vehicles ingame.
  
Line 11: Line 11:
  
 
== Example ==
 
== Example ==
 +
 +
This command will return how many vehicles are currently in the server.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
 
function onPlayerCommand( player, cmd, text )
 
function onPlayerCommand( player, cmd, text )
 
{
 
{
if ( cmd == "vehcount" )
+
    if ( cmd == "vehcount" )
{
+
    {
local count = GetVehicleCount();
+
          local count = GetVehicleCount();
MessagePlayer( "The current vehicle count is: " + count, player );
+
          MessagePlayer( "The current vehicle count is: " + count, player );
}
+
    }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
 
This command will return how many vehicles are currently 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.
+
The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Vehicles}}
 
{{Squirrel/Server/Functions/Vehicles}}

Latest revision as of 19:41, 28 September 2010

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

This function returns the number of vehicles ingame.

[edit] Syntax

  1. int GetVehicleCount()

[edit] Arguments

  • none

[edit] Example

This command will return how many vehicles are currently in the server.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "vehcount" )
  5. {
  6. local count = GetVehicleCount();
  7. MessagePlayer( "The current vehicle count is: " + count, player );
  8. }
  9. return 1;
  10. }
  11.  

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox