SetVehicleNitroCount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (typo)
Line 4: Line 4:
This function sets the nitro count to the [[vehicle]].
This function sets the nitro count to the [[vehicle]].
}}
}}
{{Warning|Only works if the vehicle is steamed in}}
{{Warning|Only works if the vehicle is streamed in}}
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setVehicleNitroCount ( vehicle theVehicle, int count )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setVehicleNitroCount ( vehicle theVehicle, int count )</syntaxhighlight>  

Revision as of 06:36, 2 January 2014

This function sets the nitro count to the vehicle.

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

Syntax

bool setVehicleNitroCount ( vehicle theVehicle, int count )

Required Arguments

  • theVehicle The vehicle which you want to set.
  • count Nitro count you want to set (ranges from 0-100, 101 is infinite).

Returns

Returns true if the nitro count was set successfully to the vehicle, false otherwise.

Example

Click to collapse [-]
Client

This function installs nitro in the vehicle and then sets the count to infinite when the player enters the vehicle.

function infiniteNitro(pPlayer)
	if pPlayer == localPlayer then
		if not getVehicleUpgradeOnSlot(source, 8) then -- Does the vehicle have nitro installed or not
			addVehicleUpgrade(source, 1010) -- Install nitrous
		end
		setVehicleNitroCount(source, 101) -- Set the nitro count to infinite
	end
end
addEventHandler("onClientVehicleEnter", root, infiniteNitro)

Requirements

This template will be deleted.

See Also