M MY Multiplayer: Wiki
Side
Kind

getPedOccupiedVehicle

Shared

Gets the vehicle a ped or player is in.

vehicle|false getPedOccupiedVehicle(ped ped)

Parameters

NameTypeDescription
pedpedThe 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)

See also