getVehicleOccupant
Shared
Returns the ped or player sitting in a seat of a vehicle.
ped|false getVehicleOccupant(vehicle vehicle [, int seat = 0])
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | vehicle | The vehicle. |
| seat | int | The seat: 0 is the driver, 1 and up the passengers (up to 15).default 0 |
Returns
The ped or player in the seat, or false if the seat is empty or does not exist, or the element is not a vehicle.
Example
addEventHandler("onVehicleEnter", root, function(ped, seat)
local driver = getVehicleOccupant(source, 0)
if driver and seat ~= 0 then
outputDebugString("a passenger got in")
end
end)