setVehicleNitroActivated | Multi Theft Auto: Wiki Skip to content

setVehicleNitroActivated

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function activates or deactivates the nitro on the specified vehicle, like if a player pressed the button for activating nitro.

Caution

Only works if the vehicle is streamed in.

Syntax

bool setVehicleNitroActivated ( vehicle theVehicle, bool state )
Required Arguments
  • theVehicle:
  • state:

Returns

  • bool: value

Returns true if the nitro activation state was modified successfully, false otherwise.

Code Examples

shared

This 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

Vehicle Functions