Author Topic: sound.PlayURL Help  (Read 2329 times)

0 Members and 1 Guest are viewing this topic.

Offline Bloody

  • Newbie
  • *
  • Posts: 1
  • Karma: -1
sound.PlayURL Help
« on: April 05, 2018, 09:36:56 PM »
I am kind of new to deving  and I really do Not know how to make this work or what is wrong with this .

local TextEntry = vgui.Create( "DTextEntry", qframe)
            TextEntry:SetPos( 25, 80 )
            TextEntry:SetSize( 300, 30 )
            TextEntry:SetText( "Paste Url" )
            TextEntry.OnEnter =  function()
            RunConsoleCommand("qmusic")
            local url = TextEntry:GetValue() -- So basicaly when you hit enter it sets the varible url and runs console command. But this is not the issue
   end
   
   end
end
concommand.Add( "qmusic", function (station) sound.PlayURL ( url, "3d"  --- this function is the issue, it will just not work.
   if ( IsValid( station ) ) then

      station:SetPos( LocalPlayer():GetPos() )

      station:Play()

   else

      LocalPlayer():ChatPrint( "Invalid URL!" )

   end
end ))

Please help,  thx.
« Last Edit: April 06, 2018, 06:56:29 AM by Bloody »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given