IsVehicleFuelTankExplodable: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Fernando187 (talk | contribs) m (Fix examples header) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 12: | Line 12: | ||
Returns ''true'' if the specified vehicle is valid and its fuel tank is explodable, ''false'' otherwise. | Returns ''true'' if the specified vehicle is valid and its fuel tank is explodable, ''false'' otherwise. | ||
== | ==Examples== | ||
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"> | <syntaxhighlight lang="lua"> | ||
Line 21: | Line 21: | ||
outputChatBox ( "Vehicle's tank is not explodable" ) | outputChatBox ( "Vehicle's tank is not explodable" ) | ||
end | end | ||
</syntaxhighlight> | |||
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> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 13:37, 8 June 2025
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.
Examples
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
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
- addVehicleUpgrade
- addVehicleSirens
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- setVehicleNitroActivated
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- removeVehicleSirens
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates