ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getVehicleController

Function

getVehicleController

Server and clientVehiclesIdentical to MTA:SA

Returns the vehicle's driver (the occupant of seat 0), or false when nobody is driving.

Syntax

player getVehicleController(vehicle vehicle)

Arguments

vehiclevehicle
The vehicle.

Returns

The driver (player or ped), or false.

Example

addEventHandler("onVehicleDamage", root, function(loss)
    local driver = getVehicleController(source)
    if driver and getElementType(driver) == "player" and loss > 100 then
        outputChatBox("Mocne uderzenie!", driver, 255, 120, 0)
    end
end)

See also