GetVehicleNitroLevel: 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 get the nitro level from the [[vehicle]].
This function get the nitro level from the [[vehicle]].
}}
}}
'''Note:''' This function return ''false'' if nitro is not exists. So you need add nitro via function [[addVehicleUpgrade]].


==Syntax==  
==Syntax==  
Line 18: Line 20:
function( pPlayer )
function( pPlayer )
if pPlayer == localPlayer then
if pPlayer == localPlayer then
local fNitroLevel = getVehicleNitroLevel( source )
if isVehicleNitroInstalled( source ) then
outputChatBox( 'Your nitro level for vehicle ' .. getVehicleName( source ) .. ' is ' .. fNitroLevel .. '.' )
local fNitroLevel = getVehicleNitroLevel( source )
outputChatBox( 'Your nitro level for vehicle ' .. getVehicleName( source ) .. ' is ' .. fNitroLevel .. '.' )
end
end
end
end
end

Revision as of 15:53, 9 February 2013

ADDED/UPDATED IN VERSION 1.3.1 r4993:

This function get the nitro level from the vehicle.

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

Syntax

float getVehicleNitroLevel ( vehicle theVehicle )

Required Arguments

  • theVehicle The vehicle which you want to get a nitro level.

Returns

Returns the nitro level [ range is 0.0001 to 1.0 ] from the vehicle.

Example

addEventHandler( 'onClientVehicleEnter', root,
	function( pPlayer )
		if pPlayer == localPlayer then
			if isVehicleNitroInstalled( source ) then
				local fNitroLevel = getVehicleNitroLevel( source )
				outputChatBox( 'Your nitro level for vehicle ' .. getVehicleName( source ) .. ' is ' .. fNitroLevel .. '.' )
			end
		end
	end
)

Requirements

This template will be deleted.

See Also