The influence of environment on gas and dust in S0 galaxies