SetVehicleFuelTankExplodable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
This function changes 'explodable state' of a vehicle's fuel tank (toggles the ability to blow it up by shooting the tank). This function will have no effect on vehicles with tanks that cannot be shot in single player.
This function changes 'explodable state' of a vehicle's fuel tank (toggles the ability to blow it up by shooting the tank). This function will have no effect on vehicles with tanks that cannot be shot in single player.
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setVehicleFuelTankExplodable ( vehicle theVehicle, bool Explodable )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setVehicleFuelTankExplodable ( vehicle theVehicle, bool explodable )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''theVehicle''': The [[vehicle]] you wish to change the fuel tank explodable state of.
*'''theVehicle''': The [[vehicle]] you wish to change the fuel tank explodable state of.
*'''Explodable''': A boolean value representing whether or not the fuel tank will be explodable.
*'''explodable''': A boolean value representing whether or not the fuel tank will be explodable.


==Returns==
==Returns==
Returns 'true' if the vehicle's fuel tank explodable state was successfully changed, 'false' otherwise.
Returns ''true'' if the vehicle's fuel tank explodable state was successfully changed, ''false'' otherwise.


==Example==
==Example==
This example will make fuel tanks explodable for 10seconds after they're entered
This example will make fuel tanks explodable for 10 seconds after they're entered
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
function onPlayerEnterVehicle ( theVehicle, seat, jacked )
function onPlayerEnterVehicle ( theVehicle, seat, jacked )
  if ( seat == 0 ) then -- if they're getting into the driver seat
    if ( seat == 0 ) then                                                       -- if they're getting into the driver seat
    setVehicleFuelTankExplodable ( theVehicle, true ) -- make it explodable
        setVehicleFuelTankExplodable ( theVehicle, true )                       -- make it explodable
    setTimer ( "setVehicleFuelTankExplodable", 10000, 1, theVehicle, false ) -- make it unexplodable in 10seconds
        setTimer ( setVehicleFuelTankExplodable, 10000, 1, theVehicle, false ) -- make it unexplodable in 10seconds
  end
    end
end
end
addEventHandler ( "onPlayerEnterVehicle", getRootElement ( ), onPlayerEnterVehicle )
</syntaxhighlight>
</syntaxhighlight>


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

Revision as of 20:41, 15 August 2007

This function changes 'explodable state' of a vehicle's fuel tank (toggles the ability to blow it up by shooting the tank). This function will have no effect on vehicles with tanks that cannot be shot in single player.

Syntax

bool setVehicleFuelTankExplodable ( vehicle theVehicle, bool explodable )

Required Arguments

  • theVehicle: The vehicle you wish to change the fuel tank explodable state of.
  • explodable: A boolean value representing whether or not the fuel tank will be explodable.

Returns

Returns true if the vehicle's fuel tank explodable state was successfully changed, false otherwise.

Example

This example will make fuel tanks explodable for 10 seconds after they're entered

function onPlayerEnterVehicle ( theVehicle, seat, jacked )
    if ( seat == 0 ) then                                                       -- if they're getting into the driver seat
        setVehicleFuelTankExplodable ( theVehicle, true )                       -- make it explodable
        setTimer ( setVehicleFuelTankExplodable, 10000, 1, theVehicle, false )  -- make it unexplodable in 10seconds
    end
end
addEventHandler ( "onPlayerEnterVehicle", getRootElement ( ), onPlayerEnterVehicle )

See Also