---@param vehicleId number
---@return {id: number, handle: number, isDriver: boolean}[] | nil list
local function getVehiclePlayersIds(vehicleId)
local result, handle = sampGetCarHandleBySampVehicleId(vehicleId);
if (not result) then return end
local list = {};
for seat = 0, getMaximumNumberOfPassengers(handle) do
local ped = getCharInCarPassengerSeat(handle, seat);
local result, id = sampGetPlayerIdByCharHandle(ped);
if (result) then
table.insert(list, { id = id, handle = ped, isDriver = getDriverOfCar(handle) == ped });
end
end
return list;
end