SetVehicleNitroLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 21: Line 21:
function changeNitroLevel(pPlayer)
function changeNitroLevel(pPlayer)
if pPlayer == localPlayer then
if pPlayer == localPlayer then
if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro in it or not
if getVehicleUpgradeOnSlot(source, 8) == 0 then -- Check if the vehicle has nitro in it or not
addVehicleUpgrade(source, 1010) -- Install nitrous
addVehicleUpgrade(source, 1010) -- Install nitrous
end
end

Revision as of 17:38, 8 July 2018

This function sets the nitro level of the vehicle.

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

Syntax

bool setVehicleNitroLevel ( vehicle theVehicle, float level )

Required Arguments

  • theVehicle The vehicle, which you want to set.
  • level Nitro level you want to set (ranges from 0.0001 to 1.0).

Returns

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

Example

Click to collapse [-]
Client

This function installs nitrous to the vehicle and sets the level of it to 0.1 when a player enters the vehicle.

function changeNitroLevel(pPlayer)
	if pPlayer == localPlayer then
		if getVehicleUpgradeOnSlot(source, 8) == 0 then -- Check if the vehicle has nitro in it or not
			addVehicleUpgrade(source, 1010) -- Install nitrous
		end
		setVehicleNitroLevel(source, 0.1) -- Set a nitro level of 0.1 to the vehicle
	end
end
addEventHandler("onClientVehicleEnter", root, changeNitroLevel)

Requirements

This template will be deleted.

See Also