getVehicleController | Multi Theft Auto: Wiki Skip to content

getVehicleController

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 is used to get the player in control of the specified vehicle which includes somebody who is trying to enter the drivers seat.

Syntax

getVehicleController ( )

Code Examples

server

This example outputs a chatbox message when a vehicle gets a trailer attached.

function scriptOnTrailerAttach ( towedBy )
thePlayer = getVehicleController ( source ) -- get the controller of the towing vehicle
if ( thePlayer ) then
outputChatBox ( getPlayerName ( thePlayer ).. " attached a trailer" )
else
outputChatBox ( "trailer attached" )
end
end
addEventHandler ( "onTrailerAttach", root, scriptOnTrailerAttach )

See Also

Vehicle Functions