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

Function

isPedInVehicle

Server and clientPedsIdentical to MTA:SA

Checks whether a ped is sitting in any vehicle (in any seat). It also returns false while the ped is still getting in, before it takes the seat. When you need the vehicle itself, use getPedOccupiedVehicle.

Syntax

bool isPedInVehicle(ped ped)

Arguments

pedped
A player or an NPC.

Returns

true when the ped is in a vehicle.

Example

addCommandHandler("teleport", function(player)
    if isPedInVehicle(player) then
        outputChatBox("Najpierw wysiądź z pojazdu.", player)
        return
    end
    setElementPosition(player, 2495, -1687, 13.5)
end)

See also