getVehicleName | Multi Theft Auto: Wiki Skip to content

getVehicleName

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

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


This function returns a string containing the name of the vehicle

Syntax

getVehicleName ( )

Code Examples

server

This example checks whether a player enters an AT-400 or a Shamal. If they do, it announces it to the chat specifying what vehicle was stolen.

function planeEnter ( theVehicle, seat, jacked ) -- when someone enters a vehicle
local id = getElementModel ( theVehicle ) -- get the model ID of the vehicle
if id == 519 or id == 577 then -- if theVehicle is either Shamal or AT-400
local vehicleName = getVehicleName ( theVehicle ) -- get the name of theVehicle
outputChatBox ( "Someone has stolen a " .. vehicleName .. "!" ) -- announce that someone has stolen the plane
end
end
-- add the event handler to the event
addEventHandler ( "onPlayerVehicleEnter", root, planeEnter )

See Also

Vehicle Functions