RemoveVehicleUpgrade: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (normalize page to match others) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | |||
{{Server client function}} | {{Server client function}} | ||
This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide. | This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide. | ||
Line 9: | Line 8: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''': The [[element]] representing the [[vehicle]] you wish to remove the upgrade from | *'''theVehicle''': The [[element]] representing the [[vehicle]] you wish to remove the upgrade from | ||
*'''upgrade''': The upgrade you wish to remove | *'''upgrade''': The ID of the upgrade you wish to remove. | ||
==Returns== | ==Returns== | ||
Line 15: | Line 14: | ||
==Example== | ==Example== | ||
This script defines a 'nos' console command that adds | <section name="Server" class="server" show="true"> | ||
This script defines a 'nos' console command that adds a NOS upgrade to the vehicle that the player who executes the command is sitting in. It also adds a 'removenos' command which allows removal of a player's nos. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function addNOS ( sourcePlayer, command ) | function addNOS ( sourcePlayer, command ) | ||
Line 21: | Line 21: | ||
if ( theVehicle ) then | if ( theVehicle ) then | ||
addVehicleUpgrade ( theVehicle, 1010 ) -- NOS 10x | addVehicleUpgrade ( theVehicle, 1010 ) -- NOS 10x | ||
end | |||
end | |||
addCommandHandler ( "nos", addNOS ) | |||
function remNOS ( sourcePlayer, command ) | |||
theVehicle = getPlayerOccupiedVehicle ( sourcePlayer ) | |||
if ( theVehicle ) then | |||
removeVehicleUpgrade ( theVehicle, 1010 ) | removeVehicleUpgrade ( theVehicle, 1010 ) | ||
end | |||
end | |||
addCommandHandler ( "removenos", remNOS ) | |||
</syntaxhighlight> | |||
</section> | |||
<section name="Client" class="client" show="false"> | |||
This script defines a 'nos' console command that adds a NOS upgrade to the vehicle that the player who executes the command is sitting in. It also adds a 'removenos' command which allows removal of a player's nos. This example is clientside and may cause desync. | |||
<syntaxhighlight lang="lua"> | |||
function addNOS ( command ) | |||
theVehicle = getPlayerOccupiedVehicle ( getLocalPlayer() ) | |||
if ( theVehicle ) then | |||
addVehicleUpgrade ( theVehicle, 1010 ) -- NOS 10x | |||
end | end | ||
end | end | ||
addCommandHandler ( "nos", addNOS ) | addCommandHandler ( "nos", addNOS ) | ||
function remNOS ( command ) | |||
theVehicle = getPlayerOccupiedVehicle ( getLocalPlayer() ) | |||
if ( theVehicle ) then | |||
removeVehicleUpgrade ( theVehicle, 1010 ) | |||
end | |||
end | |||
addCommandHandler ( "removenos", remNOS ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 08:03, 5 August 2021
This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide.
Syntax
bool removeVehicleUpgrade ( vehicle theVehicle, int upgrade )
Required Arguments
- theVehicle: The element representing the vehicle you wish to remove the upgrade from
- upgrade: The ID of the upgrade you wish to remove.
Returns
Returns true if the upgrade was successfully removed from the vehicle, otherwise false.
Example
Click to collapse [-]
ServerThis script defines a 'nos' console command that adds a NOS upgrade to the vehicle that the player who executes the command is sitting in. It also adds a 'removenos' command which allows removal of a player's nos.
function addNOS ( sourcePlayer, command ) theVehicle = getPlayerOccupiedVehicle ( sourcePlayer ) if ( theVehicle ) then addVehicleUpgrade ( theVehicle, 1010 ) -- NOS 10x end end addCommandHandler ( "nos", addNOS ) function remNOS ( sourcePlayer, command ) theVehicle = getPlayerOccupiedVehicle ( sourcePlayer ) if ( theVehicle ) then removeVehicleUpgrade ( theVehicle, 1010 ) end end addCommandHandler ( "removenos", remNOS )
Click to expand [+]
ClientSee 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