GetVehicleSirensOn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (qaisjp changed his mind)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
{{Server client function}}
This function returns whether the sirens are turned on for the specified vehicle.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Insert syntax here             
bool getVehicleSirensOn ( vehicle theVehicle )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[vehicle]]:areSirensOn|sirensOn|setVehicleSirensOn}}
===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''theVehicle:''' The vehicle that will be checked.
 
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
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==  
==Example==  
This example does...
<section name="Server" class="server" show="true">
This example toggles siren state when a player enters a vehicle as a driver.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function example_onVehicleEnter ( thePlayer, seat )
blabhalbalhb --abababa
--If the player entered as a driver
--This line does this...
if ( seat == 0 ) then
mooo
--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 )
</syntaxhighlight>
</syntaxhighlight>
</section>


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

Latest revision as of 09:44, 12 September 2018

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