SetVehicleNitroActivated

From Multi Theft Auto: Wiki

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

[[|link=]] Warning: Only works if the vehicle is steamed in.

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 [-]
Client

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

Requirements

Minimum supported server n/a
Minimum supported client 1.3.1-9.04993

Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.1-9.04993" />

See Also

FROM VERSION 1.5.7 r19626 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS