getPedOccupiedVehicle
Shared
Gets the vehicle a ped or player is in.
vehicle|false getPedOccupiedVehicle(ped ped)
Parameters
| Name | Type | Description |
|---|---|---|
| ped | ped | The ped or player. |
Returns
The vehicle, or false if the ped is not in a vehicle or the element is not a ped.
Example
addCommandHandler("fix", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
fixVehicle(vehicle)
end
end)