Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
Sound from Player
5 replies![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)
1
parse ("sv_sound3 "..x.." "..y.." "..path..")
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function sound3(id,r,snd) local px,py=player(id,"x"),player(id,"y") for _,v in pairs(player(0,"table")) do local ppx,ppy=player(v,"x"),player(v,"y") local d=math.sqrt((px-ppx)^2+(py-ppy)^2) if (d<=r) then parse("sv_sound2 "..v.." \""..snd.."\"") end end end
That's the Lua function. I didn't put comments because I'm on the phone. I think you'll figure it out. r is radius in pixels.
@kel, You can, silly.
![user](img/i_friend.png)
i said about volume of sound. like 3d sound
You should have specified what you were talking about - 'you can't do this' directed to a statement about a ranged sound function can be easily misunderstood.
![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)