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 In test (hose).
+
This command will give the specified vehicle ID, addon In test.
  
 
=== Notes ===
 
=== Notes ===

Latest 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.

[edit] Syntax

  1. bool Vehicle.SetAddon( int iAddonID )

[edit] Arguments

  • iAddonID - The ID of the vehicle addon

[edit] 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.

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox