SetVehicleNitroActivated: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (fix @ example)
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
{{New feature/item|4.0132|1.3.1|4993|
{{New feature/item|3.0131|1.3.1|4993|
This function activates the nitro on the [[vehicle]].
This function activates the nitro on the [[vehicle]].
}}
}}
 
{{Warning|Only works if the vehicle is steamed in}}
{{Warning|Function is not working correctly. -[[User:Ccw|Ccw]]}}
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setVehicleNitroActivated ( vehicle theVehicle, bool state )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setVehicleNitroActivated ( vehicle theVehicle, bool state )</syntaxhighlight>  

Revision as of 22:40, 20 May 2013

This function activates the nitro on the vehicle.

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

Syntax

bool setVehicleNitroActivated ( vehicle theVehicle, bool state )

Required Arguments

  • theVehicle The vehicle, which you want to check an activation.
  • state true if you want to activate the nitro, false if you want to disable it.

Returns

Returns true if the nitro is activated successfully on the vehicle, 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)
	end
end
addEventHandler("onClientVehicleEnter", root, activateNitro) -- When the player enters a vehicle, it executes the function

Requirements

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

Note: Using this feature 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