• sound.PlayURL acting wonky
    1 replies, posted
Been playing around with sound.PlayURL to see what it can do. For some reason the callback function returns nil in most cases. [CODE]if SERVER then concommand.Add("play_stream",function(ply,cmd,args) local stream = args[1] umsg.Start("play_stream",ply) umsg.String(stream) umsg.End() end) elseif CLIENT then local chanNum = 0 Channels = {} usermessage.Hook("play_stream",function(data) local stream = data:ReadString() sound.PlayURL(stream,"play",SetStream) end) function SetStream(chan) print("RanSetStream") print(chan) chanNum = chanNum + 1 print(chanNum) Channels[chanNum] = chan PrintTable(Channels) end end[/CODE] print(chan) in SetStream returns nil unless I spam the play_stream command, which them makes it wait a second and actually gets the userdata of the stream. Regular play_stream: [IMG]http://puu.sh/3pVc8.png[/IMG] Spammed play_stream: [IMG]http://puu.sh/3pVf9.png[/IMG] It plays the stream all fine and dandy (and when spammed, it plays it a shitton), but I'm trying to make a way to close the stream as well. Anyone got a clue as to whats up, or is it broken?
Apparently garry is doing something wrong when creating the userdata.
Sorry, you need to Log In to post a reply to this thread.