Let's say I got 3 sounds on my web server. (no I can't put them on the game server)
Player 1 wants to listen to song 1, player 2 wants song 2, player 3 wants song 3 and player 4 wants neither.
Currently PlayURL returns a channel which if I stop or change the song it does so globally.
Sure I can setup multiple channels and set the songs they want or none at all but then I'll have to do so in 3D but then sounds can and will collide.
Anyone has any idea?
sound.PlayURL is clientside, code your networking or whatever to play the sound they want,
This is the way I do it:
[lua]
//server
util.AddNetworkString('network_song')
hook.Add('PlayerSay','adsdas',function(ply,text)
if text == 'song1' then
net.Start('network_song')
net.WriteUInt(1,4)
net.Send(ply)
end
end)
//client
net.Receive('network_song', function(bit)
if net.ReadUInt() == 1 then
sound.PlayURL('link to song', '',function(chan) if IsValid(chan) then chan:Play() end)
end
end)
[/lua]
This plays it for everyone in the server.
Sorry, you need to Log In to post a reply to this thread.