Serverside Jukebox / Music Player

Hello.

I would like a script that generates a menu, where you can pick a song from a list. Those songs should be streamed from youtube or any other source on the internet if possible.
And if possible, it should be serverside, so when a player turns on the music, everyone will be listening to it.

Thanks in advance.

These scripts are currently extremely private. I doubt anyone will be willing to give you it, though there is talk of one being released soon, which I hope won’t happen.

Long story short, You would need to code it yourself, or get a lua coder for your server.

I have got the following script from ¦FlapJack¦ (Kinda reminds me of your name) on this forum.


/*
		============================
Product: Music player ^_^
Author : ¦FlapJack¦
Thanks to -- Chrisaster , Stoned
Version: 0.9
		============================
*/


local Contents = {}
local LineTable =	{}

Video = vgui.Create("HTML")
Video:SetVisible(false) 
Video:OpenURL("http://google.com/")

LineTable[1] = { Name = "Caramell Dansen Remix", Length = "2:57", URL = "http://www.youtube.com/watch?v=arOOQCJsvhY" }
LineTable[2] = { Name = "The Day That Never Comes", Length = "8:25", URL = "http://www.youtube.com/watch?v=5KAIJmxob-o" }
LineTable[3] = { Name = "Still Alive - Portal", Length = "3:05", URL = "http://www.youtube.com/watch?v=Y6ljFaKRTrI" }
LineTable[4] = { Name = "What Is Love? - Haddaway", Length = "4:04", URL = "http://www.youtube.com/watch?v=nsCXZczTQXo" }
LineTable[5] = { Name = "Smells like Teen Spirit - Nirvana" , Length = "4:56" , URL = "http://www.youtube.com/watch?v=kPQR-OsH0RQ"}
LineTable[6] = { Name = "Rape Me - Nirvana" , Length = "2:51" , URL = "http://www.youtube.com/watch?v=psvCUWzecGo"}
LineTable[7] = { Name = "Jonny Sniper - Enter Shikari" , Length = "4:28" , URL = "http://www.youtube.com/watch?v=dWbJKOThJAg"}
LineTable[8] = { Name = "Sorry You're not a Winner - Enter Shikari" , Length = "4:07" , URL = "http://www.youtube.com/watch?v=P4MiC67seUY"}
LineTable[9] = { Name = "When I Come Around  - Green Day" , Length = "2:57" , URL = "http://www.youtube.com/watch?v=imNJntb-qkA"}
LineTable[10] = { Name = "So we're named after Saints? - The Yashin" , Length = "5:56" , URL = "http://www.youtube.com/watch?v=1BupWiORPd0"}
LineTable[11] = { Name = "First rule of the Fight Club - The Yashin" , Length = "6:37" , URL = "http://www.youtube.com/watch?v=NfARPIjlVRg"}
LineTable[12] = { Name = "Pulmonary Archery - Alexisonfire" , Length = "2:33" , URL = "http://www.youtube.com/watch?v=e9jdZvAPBT0"}
LineTable[13] = { Name = "Kickapoo - Tenacious D" , Length = "4:13" , URL = "http://www.youtube.com/watch?v=WRiyefjc4Xo"}
LineTable[14] = { Name = "Fuck her Gently - Tenacious D" , Length = "2:02" , URL = "http://www.youtube.com/watch?v=DCKQ3ZNkivY"}
LineTable[15] = { Name = "Prayer of the Refugee" , Length = "3:29" , URL = "http://www.youtube.com/watch?v=pOtNqDyyX2c"}
LineTable[16] = { Name = "One - Metallica" , Length = "7:47" , URL = "http://www.youtube.com/watch?v=vdlfN18zKYc"}
LineTable[17] = { Name = "Through Fire and Flames - Dragonforce" , Length = "7:56" , URL = "http://www.youtube.com/watch?v=iFxq2e7H1tg"}
LineTable[18] = { Name = "Enter Sandman - Metallica" , Length = "5:27" , URL = "http://www.youtube.com/watch?v=aUUEjd6vrOQ"}
LineTable[19] = { Name = "Minority - Green Day" , Length = "2:48" , URL = "http://www.youtube.com/watch?v=9S-6IIumMLs"}
LineTable[20] = { Name = "Basket Case - Green Day" , Length = "2:56" , URL = "http://www.youtube.com/watch?v=GTwJo0HeNmU"}

function MusicFrame(ply,cmd,arg)		
	MusicMain = vgui.Create( "DFrame" )
	MusicMain:SetSize( 550, 550 )
	MusicMain:Center()
	MusicMain:SetTitle( "MusicPlayer" )
	MusicMain:SetVisible( true )
	MusicMain:SetDraggable( true )
	MusicMain:ShowCloseButton( true )
	MusicMain:MakePopup()

	local MusicSheet = vgui.Create( "DPropertySheet" )
	MusicSheet:SetParent(MusicMain)
	MusicSheet:SetPos(30 , 30 )
	MusicSheet:SetSize( 480, 480 )
	
	local DList = vgui.Create( "DPanel", MusicSheet )
	DList:SetSize( ScrW()-20, ScrH()-45 )
	DList.Paint = function()
		surface.SetDrawColor( 171, 171, 171, 255 )
		surface.DrawRect( 0, 0, DList:GetWide(), DList:GetTall() )
	end
	
	local Custom = vgui.Create( "DPanel", MusicSheet )
	Custom:SetSize( ScrW()-20, ScrH()-45 )
	Custom.Paint = function()
		surface.SetDrawColor( 171, 171, 171, 255 )
		surface.DrawRect( 0, 0, DList:GetWide(), DList:GetTall() )
	end

	MusicSheet:AddSheet( "Pre-set Awesomeness", DList, "gui/silkicons/user", false, false, "Pre-set Awesomeness" )
	MusicSheet:AddSheet( "Custom Stuff", Custom, "gui/silkicons/user", false, false, "Custom Stuff" )
	
	local MusicList = vgui.Create("DListView")
	MusicList:SetParent(DList)
	MusicList:SetPos(25, 50)
	MusicList:SetSize(350, 350)
	MusicList:SetMultiSelect(false)
	MusicList:AddColumn("Song")
	MusicList:AddColumn("Length")
	for index, value in pairs(LineTable) do
		MusicList:AddLine(value.Name, value.Length)
	end
	
	CustomURL = vgui.Create("DTextEntry")
	CustomURL:SetParent(DList)
	CustomURL:SetSize(250 , 30)
	CustomURL:SetPos(25 , 400)
	CustomURL:SetText("Enter a custom URL")
	CustomURL.OnEnter = function()
			CustURL = CustomURL:GetValue()  
			Video:SetHTML("")  
			Video:OpenURL(CustURL)  
	end
	


	PlayButton = vgui.Create("DButton", DList)
	PlayButton:SetSize( 50, 50 )
	PlayButton:SetPos( 400, 80 )
	PlayButton:SetText("Play")
	PlayButton.DoClick = function()
		local theSong = MusicList:GetLine(MusicList:GetSelectedLine()):GetValue(1)
		for k, v in pairs(LineTable) do
				if v.Name == theSong then  
					theLink = v.URL  
					Video:OpenURL(theLink)  
					MusicMain:Close()  
				break
			end		
		end
	end
	
	StopButton = vgui.Create("DButton" , DList)
	StopButton:SetSize(50 , 50)
	StopButton:SetPos(400 , 130)
	StopButton:SetText("Stop")
	StopButton.DoClick = function()
	Video:SetHTML("http://www.google.com/")
	end
	
	SName = vgui.Create("DTextEntry" , Custom)
	SName:SetSize(120 , 25)
	SName:SetPos(25 , 25)
	SName:SetText("Enter the song name")
	SName.OnEnter = function()
		SavedName = SName:GetValue()
	end
	
	SLength = vgui.Create("DTextEntry" , Custom)
	SLength:SetSize(120 , 25)
	SLength:SetPos(145, 25)
	SLength:SetText("Enter song length")
	SLength.OnEnter = function()
		SavedLength = SLength:GetValue()
	end
	
	SURL = vgui.Create("DTextEntry" , Custom)
	SURL:SetSize(120 , 25)
	SURL:SetPos(265 , 25)
	SURL:SetText("Enter song URL")
	SURL.OnEnter = function()
		SavedURL = SURL:GetValue()
	end
	
	SaveButton = vgui.Create("DButton")
	SaveButton:SetParent(Custom)
	SaveButton:SetSize(250 , 30)
	SaveButton:SetPos(25 , 400)
	SaveButton:SetText("Enter in data for text entry fields, then click")
	SaveButton.DoClick = function()
			SData = SavedName.."|"..SavedLength.."|".. SavedURL
			print(SData)
			if !(file.Exists("flapplayer.txt")) then file.Write("flapplayer.txt", "") end
			local oldfile = file.Read("flapplayer.txt")
			file.Write("flapplayer.txt" , oldfile.."
"..SData)
	end
	
	local SvMusicList = vgui.Create("DListView")
	SvMusicList:SetParent(Custom)
	SvMusicList:SetPos(25, 50)
	SvMusicList:SetSize(350, 350)
	SvMusicList:SetMultiSelect(false)
	SvMusicList:AddColumn("Song")
	SvMusicList:AddColumn("Length")
	for i,v in pairs(string.Explode("
",(file.Read("flapplayer.txt")))) do
		local tbl = string.Explode("|",v)
		print(#tbl)
    	SvMusicList:AddLine(tbl[1] , tbl[2])
	end

		SvPlayButton = vgui.Create("DButton")
		SvPlayButton:SetParent(Custom)
		SvPlayButton:SetSize(40 , 40)
		SvPlayButton:SetPos(400 , 80)
		SvPlayButton:SetText("Play")
		SvPlayButton.DoClick = function()
				local SvtheSong = SvMusicList:GetLine(SvMusicList:GetSelectedLine()):GetValue(1)
				for k, v in pairs(string.Explode("
",file.Read("flapplayer.txt"))) do
				if string.Explode("|",v)[1] == SvtheSong then  
					theLink = string.Explode("|",v)[3]
					Video:OpenURL(theLink)  
					MusicMain:Close()  
				break
				end
			end		
		end
	end
concommand.Add("MusicMenu", MusicFrame)

But it has been a while since i was into gmod, and i can’t remember how to run it. By the way, it is on a listen server. Can you tell me where i put it?

Hehe. One of my old scripts.

It’s entirely clientside - which is the only reason I gave it out. Just type MusicMenu in the console and it should open the menu.

Put it in lua/autorun/client if you want it to load automatically.

Ok yea i am with you so far. But lets say i paste it into a lua file and name it jukebox.lua. Where would i put it then?

If you are running ULX, just put it in ulx/modules/cl

If not, AddCSLuaFile it in any autorun server file.

Edit: Thats for sending it to people that join. Autorun/client will work if you just want it to work on yourself.

Ok thanks