IsVehicleBlown: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: {{Server client function}} __NOTOC__ This function allows you to determine whether a vehicle is blown or still intact. ==Syntax== <syntaxhighlight lang="lua">bool isVehicleBlown ( vehicle theVehicle )</...)
 
(Added an example.)
Line 13: Line 13:


==Example==
==Example==
This page lacks an example
This example creates a taxi and checks weather the taxi has blown up or not every time somebody types "/taxi".
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
---add an example here
theTaxi = createVehicle ( 420, 1, 1, 17 ) -- Add a taxi in the middle of SA
 
function checkTaxi ( source, command )
if ( isVehicleBlown ( theTaxi ) ) then -- Check weather it's blown or not
outputChatBox ( "The taxi has blown up.", source, 255, 0, 0 ) -- If so, we'll output it
else -- Anything else (if it's not)
outputChatBox ( "The taxi has not blown.", source, 255, 0, 0 ) -- If not, we'll output that instead
end
addCommandHandler ( "taxi", checkTaxi ) -- Make it check when somebody types "/taxi"
</syntaxhighlight>
</syntaxhighlight>



Revision as of 17:48, 21 February 2010

This function allows you to determine whether a vehicle is blown or still intact.

Syntax

bool isVehicleBlown ( vehicle theVehicle )

Required Arguments

  • theVehicle: The vehicle that you want to obtain the blown status of.

Returns

Returns true if the vehicle specified has blown up, false if it is still intact or the vehicle specified is invalid.

Example

This example creates a taxi and checks weather the taxi has blown up or not every time somebody types "/taxi".

theTaxi = createVehicle ( 420, 1, 1, 17 ) -- Add a taxi in the middle of SA

function checkTaxi ( source, command )
	if ( isVehicleBlown ( theTaxi ) ) then -- Check weather it's blown or not
		outputChatBox ( "The taxi has blown up.", source, 255, 0, 0 ) -- If so, we'll output it
	else -- Anything else (if it's not)
		outputChatBox ( "The taxi has not blown.", source, 255, 0, 0 ) -- If not, we'll output that instead
end
addCommandHandler ( "taxi", checkTaxi ) -- Make it check when somebody types "/taxi"

See Also