getVehicleOccupant | Multi Theft Auto: Wiki Skip to content

getVehicleOccupant

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 gets the player sitting/trying to enter the specified vehicle.

Syntax

getVehicleOccupant ( )

Code Examples

server

This example announces the driver of a certain vehicle whenever it is damaged:

function onStolenVehicleDamage ( loss )
local driver = getVehicleOccupant ( source ) -- get the player sitting in seat 0
if ( driver ) then -- if the driver exists, display a message
outputChatBox ( getPlayerName ( driver ) .. " is wrecking the vehicle he stole!" )
end
end
addEventHandler ( "onVehicleDamage", stolenVehicle, onStolenVehicleDamage )

See Also

Vehicle Functions