How can I set that a player via a menu can activate a sound that the rest of the players can hear?
I tried these:
[code]sound.Play()
player.EmitSound()[/code]
But when I try them no sound comes out and no errors either.
[lua]for _,v in pairs(player.GetAll()) do
v:ConCommand("playsound /path/sound.wav")
end[/lua]
If playsound doesn't work try using play.
[editline]wat[/editline]
Why is everybody trying to overcomplicate it besides me?
[QUOTE=RonanZer0;46199726][lua]for _,v in pairs(player.GetAll()) do
v:ConCommand("playsound /path/sound.wav")
end[/lua]
If playsound doesn't work try using play.[/QUOTE]
I created a Derma Menu, making it as a Taunt Menu for Prop Hunt.
I don't look to make it too complex.
The following code plays the sound to everyone?
[code]surface.PlaySound("Sound/Dir.wav")[/code]
[lua]
for _,ply in pairs(player.GetAll()) do
ply:EmitSound("path/to/sound.whatever")
end
[/lua]
[QUOTE=LUModder;46201379][lua]
for _,ply in pairs(player.GetAll()) do
ply:EmitSound("path/to/sound.whatever")
end
[/lua][/QUOTE]That will do so that all the players will play the same sound at the same time and other players will hear it
[QUOTE=Dummore;46201507]That will do so that all the players will play the same sound at the same time and other players will hear it[/QUOTE]
Then you can just do this:
[lua]
for _,ply in pairs(player.GetAll()) do
ply:SendLua[[LocalPlayer():EmitSound("path/to/sound.whatever")]]
end
[/lua]
[QUOTE=LUModder;46201990]Then you can just do this:
[lua]
for _,ply in pairs(player.GetAll()) do
ply:SendLua[[LocalPlayer():EmitSound("path/to/sound.whatever")]]
end
[/lua][/QUOTE]My bad the first will work if you put in a [B]clientside[/B] file.
If you want to play music from an URL(MP3) to a person or anyone, you could use this code snippet, and replace the URL in it. (You can use both ply:SendLua(for a single target) and BroadcastLua(for everyone on the server)
[lua]
BroadcastLua(sound.PlayURL("http://nitrogaming.org/stuff/salsa.mp3", " ", function(x) end))
-- So fun to troll with :wink:
[/lua]
Sorry, you need to Log In to post a reply to this thread.