Skip to content

getVehicleType

Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function retrieves the type of a vehicle (such as if it is a car or a boat).

OOP Syntax Help! I don't understand this!

  • Method:vehicle:getVehicleType(...)
  • Variable: .vehicleType

Syntax

string getVehicleType ( ​vehicle theVehicle )
Required arguments
  • theVehicle: MISSING_PARAM_DESC

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).

  • string: value

Code Examples

shared

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", root, enterPlane)

See Also

Vehicle Functions