SetVehicleNitroActivated: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Remove obsolete Requirements section)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Shared function}}
{{New feature/item|3.0131|1.3.1|4993|
This function activates or deactivates the nitro on the specified [[vehicle]], like if a player pressed the button for activating nitro.
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.}}
{{Warning|Only works if the vehicle is streamed in.}}
==Syntax==  
==Syntax==  
Line 30: Line 29:
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
==Changelog==
{{ChangelogHeader}}
{{ChangelogItem|1.6.0-9.22862|Added to the server side, the function is now shared}}


==See Also==
==See Also==
{{Client_vehicle_functions}}
{{Vehicle_functions}}

Latest revision as of 02:48, 31 December 2024

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 streamed 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

Changelog

Version Description
1.6.0-9.22862 Added to the server side, the function is now shared

See Also