GetVehicleSirensOn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP)
Line 8: Line 8:
bool getVehicleSirensOn ( vehicle theVehicle )
bool getVehicleSirensOn ( vehicle theVehicle )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[vehicle]]:areSirensOn|sirensOn|setVehicleSirensOn}}
===Required Arguments===  
===Required Arguments===  
*'''theVehicle:''' The vehicle that will be checked.
*'''theVehicle:''' The vehicle that will be checked.

Revision as of 23:15, 17 December 2014

Dialog-information.png This article needs checking.

Reason(s): Should be areVehicleSirensOn qaisjp (talk) 12:21, 15 June 2014 (UTC)

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

Syntax

bool getVehicleSirensOn ( vehicle theVehicle )

OOP Syntax Help! I don't understand this!

Method: vehicle:areSirensOn(...)
Variable: .sirensOn
Counterpart: setVehicleSirensOn


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