IsVehicleFuelTankExplodable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Server client function}}
__NOTOC__
__NOTOC__
This will tell you if a vehicle's petrol tank is explodable.
This will tell you if a vehicle's petrol tank is explodable.
Line 6: Line 7:


===Required Arguments===
===Required Arguments===
*'''theVehicle''': The [[vehicle]] that you need to obtain the fuel tank status of.
*'''theVehicle:''' The [[vehicle]] that you want to obtain the fuel tank status of.


===Returns===
===Returns===
Returns ''true'' if the specified vehicle is valid and it's fuel tank is explodable, ''false'' otherwise.
Returns ''true'' if the specified vehicle is valid and its fuel tank is explodable, ''false'' otherwise.


==Example==
==Example==
This example creates a vehicle then displays if it fuel tank is explodable or not in the chatbox.
This example creates a vehicle, then displays if it fuel tank is explodable or not in the chatbox.
<syntaxhighlight lang="lua">newcar = createVehicle ( 520, 1024, 1024, 1024 )
<syntaxhighlight lang="lua">
newcar = createVehicle ( 520, 1024, 1024, 1024 )
if ( isVehicleFuelTankExplodable ( newcar ) ) then
if ( isVehicleFuelTankExplodable ( newcar ) ) then
  outputChatBox ( "Vehicle's tank is explodable" )
    outputChatBox ( "Vehicle's tank is explodable" )
else
else
  outputChatBox ( "Vehicle's tank is not explodable" )
    outputChatBox ( "Vehicle's tank is not explodable" )
end</syntaxhighlight>
end
</syntaxhighlight>
==Example 2==
This example toggles vehicle fuel tank explodable when the player type ''fueltank'' in the chat.
<syntaxhighlight lang="lua">
function toggleFuelTankExplodable(playerSource)
vehicle = getPedOccupiedVehicle(playerSource)
    if vehicle then
        if isVehicleFuelTankExplodable(vehicle) then
            setVehicleFuelTankExplodable(vehicle, false)
        else
            setVehicleFuelTankExplodable(vehicle, true)
        end
    else
        outputChatBox("You are not in a vehicle.", playerSource, 220, 0, 0)
    end
end
addCommandHandler("fueltank", toggleFuelTankExplodable)
</syntaxhighlight>


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

Latest revision as of 07:32, 16 February 2013

This will tell you if a vehicle's petrol tank is explodable.

Syntax

bool isVehicleFuelTankExplodable ( vehicle theVehicle )

Required Arguments

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

Returns

Returns true if the specified vehicle is valid and its fuel tank is explodable, false otherwise.

Example

This example creates a vehicle, then displays if it fuel tank is explodable or not in the chatbox.

newcar = createVehicle ( 520, 1024, 1024, 1024 )
if ( isVehicleFuelTankExplodable ( newcar ) ) then
    outputChatBox ( "Vehicle's tank is explodable" )
else
    outputChatBox ( "Vehicle's tank is not explodable" )
end

Example 2

This example toggles vehicle fuel tank explodable when the player type fueltank in the chat.

function toggleFuelTankExplodable(playerSource)
vehicle = getPedOccupiedVehicle(playerSource)
    if vehicle then
        if isVehicleFuelTankExplodable(vehicle) then
            setVehicleFuelTankExplodable(vehicle, false)
        else
            setVehicleFuelTankExplodable(vehicle, true)
        end
    else
        outputChatBox("You are not in a vehicle.", playerSource, 220, 0, 0)
    end
end
addCommandHandler("fueltank", toggleFuelTankExplodable)

See Also