GetVehicleSirensOn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Highlighting fix)
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server client function}}
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 14: Line 15:


==Example==  
==Example==  
<section name="Server" class="server" show="true">
This example toggles siren state when a player enters a vehicle as a driver.
This example toggles siren state when a player enters a vehicle as a driver.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 29: Line 31:
addEventHandler ( "onVehicleEnter", getRootElement(), example_onVehicleEnter )
addEventHandler ( "onVehicleEnter", getRootElement(), example_onVehicleEnter )
</syntaxhighlight>
</syntaxhighlight>
</section>


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

Revision as of 11:29, 13 August 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

Click to collapse [-]
Server

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

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

See Also