Squirrel/Server/Functions/Vehicles/SetAddon

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
(Example)
Line 25: Line 25:
 
</code>
 
</code>
  
This command will give the specified vehicle ID, addon 1 (hose).
+
This command will give the specified vehicle ID, addon In test (hose).
  
 
=== Notes ===
 
=== Notes ===

Revision as of 14:45, 10 August 2013

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

This function attaches an add-on to the given vehicle. List of add-on IDs can be found from here. If you want to remove the add-on from the vehicle, set the add-on to VEHADDON_NONE.

Syntax

  1. bool Vehicle.SetAddon( int iAddonID )

Arguments

  • iAddonID - The ID of the vehicle addon

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setvehaddon" )
  5. {
  6. if ( text )
  7. {
  8. local veh = FindVehicle( text.tointeger() );
  9. if ( veh ) veh.SetAddon( test );
  10. }
  11. }
  12. }
  13.  

This command will give the specified vehicle ID, addon In test (hose).

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