You don’t need to get the vehicle entity, you can simply use IsPedInAnyVehicle and in a while true use Citizen.Wait(0).
So this should work:
Citizen.CreateThread(function()
while true do
if IsPedInAnyVehicle(PlayerPedId(), false) then
DisableControlAction( 1, 86, true )
end
Citizen.Wait(0)
end
end)