Forum

> > CS2D > Scripts > Sound from Player
Forums overviewCS2D overview Scripts overviewLog in to reply

English Sound from Player

5 replies
To the start Previous 1 Next To the start

old Sound from Player

Obviously Exactly Myself
User Off Offline

Quote
How do I add a lua parse command that will play a sound coming from a specific player. I tried using sv_sound2 but only the player can hear it not the others near him.

old Re: Sound from Player

EngiN33R
Moderator Off Offline

Quote
1
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.

old Re: Sound from Player

EngiN33R
Moderator Off Offline

Quote
user Kel9290 has written
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 Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview