Squirrel/Server/Functions/Vehicles/Model

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Vehicle.Model}} __NOTOC__ This ''Vehicle'' class member returns the Model of the given vehicle. == Syntax == <code>Integer vehicle.Model</code> == Example == …')
 
 
Line 4: Line 4:
  
 
== Syntax ==
 
== Syntax ==
<code>Integer vehicle.Model</code>
+
<code>Integer Vehicle.Model</code>
  
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
+
This returns the model ID of vehicle ID 0.
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- Todo
+
function onPlayerCommand( pPlayer, szCommand, szText )
 +
{
 +
if ( szCommand == "model" )
 +
{
 +
local pVehicle = FindVehicle( 0 );
 +
if ( pVehicle ) MessagePlayer( "Vehicle ID 0's model ID is " + pVehicle.Model, pPlayer );
 +
}
 +
 +
return 1;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.  
+
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Vehicles/FindVehicle|FindVehicle]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
  
  

Latest revision as of 17:38, 25 October 2010

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


This Vehicle class member returns the Model of the given vehicle.

[edit] Syntax

  1. Integer Vehicle.Model

[edit] Example

This returns the model ID of vehicle ID 0.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "model" )
  5. {
  6. local pVehicle = FindVehicle( 0 );
  7. if ( pVehicle ) MessagePlayer( "Vehicle ID 0's model ID is " + pVehicle.Model, pPlayer );
  8. }
  9. return 1;
  10. }
  11.  

[edit] Notes

The functions MessagePlayer and FindVehicle and event 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