SetVehicleNitroActivated: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (<section />)
m (fix @ example)
Line 24: Line 24:
if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro installed or not
if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro installed or not
addVehicleUpgrade(source, 1010) -- Install the nitrous
addVehicleUpgrade(source, 1010) -- Install the nitrous
setVehicleNitroActivated(source, true) -- Activate the nitro
else
setVehicleNitroActivated(source, true)
end
end
setVehicleNitroActivated(source, true)
end
end
end
end

Revision as of 12:00, 14 March 2013

ADDED/UPDATED IN VERSION 1.3.1 r4993:

This function activates the nitro on the vehicle.

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

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

Click to collapse [-]
Client

This example adds and activates nitro in the vehicle the player enters.

function activateNitro(pPlayer)
	if pPlayer == localPlayer then
		if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro installed or not
			addVehicleUpgrade(source, 1010) -- Install the nitrous
		end
		setVehicleNitroActivated(source, true)
	end
end
addEventHandler("onClientVehicleEnter", root, activateNitro) -- When the player enters a vehicle, it executes the function

Requirements

This template will be deleted.

See Also