Metallicity effects on cosmic Type Ib/c supernovae and gamma-ray burst rates