SetVehicleNitroActivated: Difference between revisions
Jump to navigation
Jump to search
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
|||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New feature/item| | {{New feature/item|3.0131|1.3.1|4993| | ||
This function | This function activates or deactivates the nitro on the specified [[vehicle]], like if a player pressed the button for activating nitro. | ||
}} | }} | ||
{{Warning|Only works if the vehicle is streamed in.}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setVehicleNitroActivated ( vehicle theVehicle, bool state )</syntaxhighlight> | <syntaxhighlight lang="lua">bool setVehicleNitroActivated ( vehicle theVehicle, bool state )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''' The [[vehicle]] | *'''theVehicle''' The [[vehicle]] to activate or deactivate the nitro on. | ||
*'''state''' true if you want to activate the nitro, false if you want to disable it. | *'''state''' ''true'' if you want to activate the nitro, ''false'' if you want to disable it. | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the nitro | Returns ''true'' if the nitro activation state was modified successfully, ''false'' otherwise. | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <section name="Client" class="client" show="true"> | ||
This example adds and activates nitro in the vehicle the player enters. | |||
<syntaxhighlight lang="lua"> | |||
function activateNitro(pPlayer) | |||
if pPlayer == localPlayer then | |||
if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro installed or not | |||
addVehicleUpgrade(source, 1010) -- Install the nitrous | |||
end | end | ||
setVehicleNitroActivated(source, true) -- Activate the nitro | |||
end | end | ||
)</syntaxhighlight> | end | ||
addEventHandler("onClientVehicleEnter", root, activateNitro) -- When the player enters a vehicle, it executes the function | |||
</syntaxhighlight> | |||
</section> | |||
==See Also== | ==See Also== | ||
{{Client_vehicle_functions}} | {{Client_vehicle_functions}} |
Latest revision as of 17:10, 7 November 2024
This function activates or deactivates the nitro on the specified vehicle, like if a player pressed the button for activating nitro.
Syntax
bool setVehicleNitroActivated ( vehicle theVehicle, bool state )
Required Arguments
- theVehicle The vehicle to activate or deactivate the nitro on.
- state true if you want to activate the nitro, false if you want to disable it.
Returns
Returns true if the nitro activation state was modified successfully, false otherwise.
Example
Click to collapse [-]
ClientThis example adds and activates nitro in the vehicle the player enters.
function activateNitro(pPlayer) if pPlayer == localPlayer then if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro installed or not addVehicleUpgrade(source, 1010) -- Install the nitrous end setVehicleNitroActivated(source, true) -- Activate the nitro end end addEventHandler("onClientVehicleEnter", root, activateNitro) -- When the player enters a vehicle, it executes the function
See Also
- areVehicleLightsOn
- getHeliBladeCollisionsEnabled
- getHelicopterRotorSpeed
- getVehicleAdjustableProperty
- getVehicleComponentPosition
- getVehicleComponentRotation
- getVehicleComponents
- getVehicleComponentScale
- getVehicleComponentVisible
- getVehicleCurrentGear
- getVehicleDummyPosition
- getVehicleGravity
- getVehicleLandingGearDown
- getVehicleModelDummyDefaultPosition
- getVehicleModelDummyPosition
- getVehicleModelExhaustFumesPosition
- getVehicleModelWheelSize
- getVehicleNitroCount
- getVehicleNitroLevel
- getVehicleWheelFrictionState
- getVehicleWheelScale
- isTrainChainEngine
- isVehicleNitroActivated
- isVehicleNitroRecharging
- isVehicleOnGround
- isVehicleWheelOnGround
- isVehicleWindowOpen
- resetVehicleComponentPosition
- resetVehicleComponentRotation
- resetVehicleComponentScale
- resetVehicleDummyPositions
- setHeliBladeCollisionsEnabled
- setHelicopterRotorSpeed
- setVehicleAdjustableProperty
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDummyPosition
- setVehicleGravity
- setVehicleLandingGearDown
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleWheelScale
- setVehicleWheelStates
- setVehicleWindowOpen
- Shared
- 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