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

Function

getPedOccupiedVehicleSeat

Server and clientPedsIdentical to MTA:SA

Returns the seat number a ped occupies: 0 is the driver, 1 the front passenger, 2 and 3 the rear seats (buses and trains also use higher numbers). When the ped is on foot it returns false. Useful when a command should work only for the driver.

Syntax

int getPedOccupiedVehicleSeat(ped ped)

Arguments

pedped
A player or an NPC.

Returns

Seat number (0 = driver), or false.

Example

addCommandHandler("silnik", function(player)
    local car = getPedOccupiedVehicle(player)
    if car and getPedOccupiedVehicleSeat(player) == 0 then
        setVehicleEngineState(car, not getVehicleEngineState(car))
    end
end)

See also