- Documentation
- Shared functions
- getPedOccupiedVehicleSeat
Function
getPedOccupiedVehicleSeat
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
getPedOccupiedVehicleReturns the vehicle a ped is sitting in (as the driver or a passenger). When the ped is on foot it returnsfalse. It is the simplest way to find out what a player is driving, e.g. to repair or recolour their car.getVehicleOccupantReturns the player or ped sitting in the given seat of a vehicle. Seat 0 is the driver, 1 the front passenger, 2 and 3 the rear seats.