SetVehicleNitroActivated: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
This function activate the nitro on the [[vehicle]].
This function activate the nitro on the [[vehicle]].
}}
}}
'''Note:''' This function return ''false'' if nitro is not exists. So you need add nitro via function [[addVehicleUpgrade]].


==Syntax==  
==Syntax==  
Line 19: Line 21:
function( pPlayer )
function( pPlayer )
if pPlayer == localPlayer then
if pPlayer == localPlayer then
addVehicleUpgrade( source, 1010 ) -- Install a nitro.
if not isVehicleNitroInstalled( source ) then
setVehicleNitroActivated( source, true ) -- Activate the nitro.
addVehicleUpgrade( source, 1010 ) -- Install a nitro.
setVehicleNitroActivated( source, true ) -- Activate the nitro.
end
end
end
end
end

Revision as of 15:55, 9 February 2013

ADDED/UPDATED IN VERSION 1.3.1 r4993:

This function activate the nitro on the vehicle.

Note: This function return false if nitro is not exists. So you need add nitro via function addVehicleUpgrade.

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

addEventHandler( 'onClientVehicleEnter', root,
	function( pPlayer )
		if pPlayer == localPlayer then
			if not isVehicleNitroInstalled( source ) then
				addVehicleUpgrade( source, 1010 ) -- Install a nitro.
				setVehicleNitroActivated( source, true ) -- Activate the nitro.
			end
		end
	end
)

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