Nowherebrain is right , use something like
snd_vol = ((vec_dist(player.x,sound emitting entity.x) / 20) * -1) + 100;
if snd_vol > 100) { snd_vol = 100; }
if snd_vol < 0) { snd_vol = 0; }

the math...if see(sound emitting entity) is 2000 quants away - snd_vol = 2000 / 20 = 100 * -1 = -100 + 100 = 0.
if see is 1 quant away = 1 / 20 = 0.05 * -1 = -0.05 + 100 = 99.95 (almost max snd vol for example)
Thats in case the sound distance is maximum 2000 quants. Divide by more for higher values. 200 / 2 or 20000 / 200...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201