AddVehicleUpgrade: Difference between revisions
Jump to navigation
Jump to search
(Added template, sections, minor changes) |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function adds an upgrade to an existing vehicle, eg: nos, hyrdraulics. | {{Server client function}} | ||
This function adds an upgrade to an existing vehicle, eg: nos, hyrdraulics. These upgrades are listed in San Andreas\data\maps\veh_mods\veh_mods.ide. | |||
==Syntax== | ==Syntax== | ||
<section name="Server and Client" class="both" show="true"> | |||
<syntaxhighlight lang="lua">bool addVehicleUpgrade ( vehicle theVehicle, int upgrade )</syntaxhighlight> | <syntaxhighlight lang="lua">bool addVehicleUpgrade ( vehicle theVehicle, int upgrade )</syntaxhighlight> | ||
Line 11: | Line 13: | ||
==Returns== | ==Returns== | ||
Returns ''true'' if the upgrade was successfully added to the vehicle, otherwise ''false''. | Returns ''true'' if the upgrade was successfully added to the vehicle, otherwise ''false''. | ||
</section> | |||
==Example== | ==Example== | ||
<section name="Example 1" class="server"> | |||
This serverside function allows the user to get an upgrade by typing a command: | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | -- define the handler function for our command | ||
function consoleAddUpgrade ( thePlayer, commandName, id ) | function consoleAddUpgrade ( thePlayer, commandName, id ) | ||
-- make sure the player is in a vehicle | -- make sure the player is in a vehicle | ||
Line 35: | Line 39: | ||
end | end | ||
end | end | ||
-- add the function as a handler for the "addupgrade" command | |||
addCommandHandler ( "addupgrade", consoleAddUpgrade ) | addCommandHandler ( "addupgrade", consoleAddUpgrade ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
<section name="Example 2" class="client"> | |||
This client-side script gives vehicles a nitro upgrade whenever they pass through a certain collision shape: | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- create a collision shape | -- create a collision shape | ||
Line 51: | Line 59: | ||
addEventHandler ( "onClientColShapeHit", nitroColShape, onNitroColShapeHit ) | addEventHandler ( "onClientColShapeHit", nitroColShape, onNitroColShapeHit ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Revision as of 22:00, 12 August 2007
This function adds an upgrade to an existing vehicle, eg: nos, hyrdraulics. These upgrades are listed in San Andreas\data\maps\veh_mods\veh_mods.ide.
Syntax
Click to collapse [-]
Server and Clientbool addVehicleUpgrade ( vehicle theVehicle, int 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. (1000 to 1193)
Returns
Returns true if the upgrade was successfully added to the vehicle, otherwise false.
Example
Click to expand [+]
Example 1Click to expand [+]
Example 2See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates