Squirrel/Server/Functions/Vehicles/GetAddon

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function returns the add-on attached to a vehicle. List of add-on IDs can be found from here. If the vehicle has no add-on, VEHA...)
 
(Example)
Line 11: Line 11:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "vehaddon" )
 +
{
 +
if ( player.Vehicle )
 +
{
 +
local addon = player.Vehicle.GetAddon();
 +
MessagePlayer( "This vehicle currently has addon: " + addon, player );
 +
}
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This command will return what addon the the player's vehicle has.
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes/used functions here
+
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/Vehicles}}
 
{{Squirrel/Server/Functions/Vehicles}}

Revision as of 14:36, 8 March 2010

This function returns the add-on attached to a vehicle. List of add-on IDs can be found from here. If the vehicle has no add-on, VEHADDON_NONE will be returned.

Syntax

  1. int Vehicle.GetAddon()

Arguments

  • none

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "vehaddon" )
  5. {
  6. if ( player.Vehicle )
  7. {
  8. local addon = player.Vehicle.GetAddon();
  9. MessagePlayer( "This vehicle currently has addon: " + addon, player );
  10. }
  11. }
  12. }
  13.  

This command will return what addon the the player's vehicle has.

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox