AddVehicleUpgrade

From Multi Theft Auto: Wiki
Revision as of 23:42, 9 July 2006 by EAi (talk | contribs)
Jump to navigation Jump to search

This function adds an upgrade to an existing vehicle, eg: nos, hyrdraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide.

Syntax

bool addVehicleUpgrade ( vehicle theVehicle, upgrade )

Required Arguments

  • theVehicle: The element representing the vehicle you wish to add the upgrade to.
  • upgrade: The id of the upgrade you wish to add.

Returns

Returns 'true' if the upgrade was successfully added to the vehicle, otherwise 'false'.

Example

addEventHandler ( "onPlayerConsole", root, "onPlayerConsole" )
function onPlayerConsole ( text )
  command = split ( text, 1, 32 )
  if ( command == "nos" ) then
    vehicle = getPlayerOccupiedVehicle ( source )
    if ( vehicle ) then
      addVehicleUpgrade ( vehicle, 1010 ) -- nos-10x
    end
  end
end

See Also