GetVehicleSirensOn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__  
__NOTOC__  
This function returns whether the sirens are turned on for the specified vehicle.
This function returns whether the sirens are turned on for the specified vehicle.
Line 16: Line 14:


==Example==  
==Example==  
This example does...
This example toggles siren state when a player enters a vehicle as a driver.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
addEventHandler ( "onVehicleEnter", getRootElement(), "example_onVehicleEnter" )
blabhalbalhb --abababa
function example_onVehicleEnter ( player, seat, jacked )
--This line does this...
--If the player entered as a driver
mooo
if seat == 0 then
--If siren was off
if not getVehicleSirensOn ( source ) then
setVehicleSirenOn ( source, true ) --Turn it on
else
setVehicleSirenOn ( source, false ) --Turn it off
end
end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Vehicle functions}}

Revision as of 17:12, 11 January 2007

This function returns whether the sirens are turned on for the specified vehicle.

Syntax

bool getVehicleSirensOn ( vehicle theVehicle )

Required Arguments

  • theVehicle: The vehicle that will be checked

Returns

Returns true if the sirens are turned on for the specified vehicle, false if the sirens are turned off for the specified vehicle, if the vehicle doesn't have sirens or if invalid arguments are specified.

Example

This example toggles siren state when a player enters a vehicle as a driver.

addEventHandler ( "onVehicleEnter", getRootElement(), "example_onVehicleEnter" )
function example_onVehicleEnter ( player, seat, jacked )
	--If the player entered as a driver
	if seat == 0 then
		--If siren was off
		if not getVehicleSirensOn ( source ) then
			setVehicleSirenOn ( source, true )	--Turn it on
		else
			setVehicleSirenOn ( source, false )	--Turn it off
		end
	end
end

See Also