GetVehicleType
From Multi Theft Auto: Wiki
This function retrieves the type of a vehicle (such as if it is a car or a boat).
Syntax
string getVehicleType ( vehicle theVehicle )
OOP Syntax Help! I don't understand this!
- Method: vehicle:getVehicleType(...)
- Variable: .vehicleType
OR
string getVehicleType ( int modelId )
Required Arguments
- vehicle: The vehicle element to get the type of.
OR
- modelID: A vehicle model ID
Returns
Returns a string with vehicle type or false if an invalid modelID has been supplied, or an empty string if the vehicle is blocked internally (some trailers).
Possible strings returned:
- Automobile: Cars, vans and trucks
- Plane
- Bike: Motorbikes
- Helicopter
- Boat
- Train
- Trailer: A trailer for a truck
- BMX
- Monster Truck
- Quad: Quadbikes
Example
Example 1: In this example when a player enters an airplane, it displays a message welcoming the player onboard.
function enterPlane(theVehicle, seat, jacked) if (getVehicleType(theVehicle) == "Plane") then outputChatBox("Welcome onboard!", source) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), enterPlane)
Example 2: In this example player gets message what type of vehicle he just entered.
function enteredVehicleType(theVehicle, seat, jacked) outputChatBox("You entered ".. getVehicleType(theVehicle) ..".", source) end addEventHandler("onPlayerVehicleEnter", getRootElement(), enteredVehicleType)
See Also
FROM VERSION 1.5.7 r19626 ONWARDS
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getModelHandling
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
FROM VERSION 1.6 r7485 ONWARDS
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- getVehiclesOfType
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleSirens
- removeVehicleUpgrade
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setModelHandling
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
FROM VERSION 1.6 r7485 ONWARDS
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleIdleRespawnDelay
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition