VehicleClient

isVehicleSeatFree

IS_VEHICLE_SEAT_FREE0x22AC59A870E6A669

The GTA V native IS_VEHICLE_SEAT_FREE of the VEHICLE namespace, as LS:MP client scripts call it: the global function isVehicleSeatFree, in JavaScript and in Lua.

SignatureJavaScript
isVehicleSeatFree(
  vehicle: Vehicle,
  seatIndex: number,
  isTaskRunning: boolean
): boolean
SignatureLua
isVehicleSeatFree(
  vehicle: Vehicle,
  seatIndex: integer,
  isTaskRunning: boolean
): boolean

Usage

JavaScript
const result = isVehicleSeatFree(vehicle, seatIndex, isTaskRunning);
Lua
local result = isVehicleSeatFree(vehicle, seatIndex, isTaskRunning)

Parameters

ParameterTypeJavaScriptLua
vehicleVehiclenumberinteger
seatIndexintnumberinteger
isTaskRunningBOOLbooleanboolean

Returns

BOOL JavaScript boolean, Lua boolean

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Check if a vehicle seat is free.

seatIndex = -1 being the driver seat.
Use getVehicleMaxNumberOfPassengers(vehicle) - 1 for last seat index.
isTaskRunning = on true the function returns already false while a task on the target seat is running (taskEnterVehicle/taskShuffleToNextVehicleSeat) - on false only when a ped is finally sitting in the seat.

Reference

Namespace
Vehicle VEHICLE
In the game
BOOL IS_VEHICLE_SEAT_FREE(Vehicle vehicle, int seatIndex, BOOL isTaskRunning)
Hash
0x22AC59A870E6A669

Open in the interactive natives reference