SetVehicleGunsEnabled: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 18: | Line 18: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function disableFireForHydra ( theVehicle, seat, jacked ) | function disableFireForHydra ( theVehicle, seat, jacked ) | ||
if ( | if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra | ||
setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns | setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns | ||
else -- if they entered another vehicle | else -- if they entered another vehicle | ||
Line 31: | Line 31: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function disableFireForHydra ( theVehicle, seat ) | function disableFireForHydra ( theVehicle, seat ) | ||
if ( | if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra | ||
setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns | setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns | ||
else -- if they entered another vehicle | else -- if they entered another vehicle |
Revision as of 15:29, 3 August 2010
This function enables or disables the weapons on a vehicle
Syntax
bool setVehicleGunsEnabled ( vehicle theVehicle, bool gunsEnabled )
Required Arguments
- theVehicle: The element representing the vehicle whose guns you want to toggle.
- gunsEnabled: A bool representing whether guns are enabled or disabled. false will disable them, true will enable them.
Returns
Returns true if the guns were toggled succesfully, false if arguments passed were invalid.
Example
Click to collapse [-]
Example 1This function will disables the ability to fire rockets on a hydra.
function disableFireForHydra ( theVehicle, seat, jacked ) if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns else -- if they entered another vehicle setVehicleGunsEnabled ( theVehicle, true ) -- enable their guns end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra )
Click to expand [+]
Example 2See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- 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
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates