IsVehicleTaxiLightOn

From Multi Theft Auto: Wiki
Revision as of 12:42, 30 November 2009 by Morozzzko (talk | contribs) (→‎Example)
Jump to navigation Jump to search

This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)

Syntax

bool isVehicleTaxiLightOn ( vehicle taxi )              

Required Arguments

  • taxi: The vehicle element of the taxi that you wish to get the light state of.

Returns

Returns true if the light is on, false otherwise.

Example

Click to collapse [-]
Client
function myfunction()
	local player = getLocalPlayer()
	local vehicle = getPlayerOccupiedVehicle(player)
	if player == getVehicleOccupant(vehicle, 0) then -- if is a driver
		local lights = getVehicleTaxiLightOn(vehicle) -- getting vehicle model
		local id = getElementModel(vehicle)
		if ((id == 420) or (id== 438) then -- if is a taxi
			setVehicleTaxiLightOn(vehicle, not lights) -- switch lights
		end
	end	
end

bind("o", "down", myfunction) -- binding the function

See Also