SetVehicleNitroCount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (fixes)
m (fix)
Line 2: Line 2:
{{Client function}}
{{Client function}}
{{New feature/item|4.0132|1.3.1|4993|
{{New feature/item|4.0132|1.3.1|4993|
This function set the nitro count to the [[vehicle]].
This function sets the nitro count to the [[vehicle]].
}}
}}


Line 11: Line 11:
===Required Arguments===  
===Required Arguments===  
*'''theVehicle''' The [[vehicle]] which you want to set.
*'''theVehicle''' The [[vehicle]] which you want to set.
*'''count''' Nitro count you want to set [0-100] 101 - is infinite.
*'''count''' Nitro count you want to set (ranges from 0-100, 101 is infinite).


===Returns===
===Returns===

Revision as of 11:56, 14 March 2013

ADDED/UPDATED IN VERSION 1.3.1 r4993:

This function sets the nitro count to the vehicle.


[[|link=|]] Warning: Function is not working correctly. -Ccw

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
			setVehicleNitroCount(source, 101) -- Set the nitro count to infinite
		else
			setVehicleNitroCount(source, 101) -- Set the nitro count to infinite
		end
	end
end
addEventHandler("onClientVehicleEnter", root, infiniteNitro)

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