F1 Server Menu

Hello, recently one of my administrators for my community came up with a good feature that I have been unable to find any such addon which can do this.

This was a simple code he asked for me to enter.

We were looking for two different codes:

  1. A menu (that will be opened by pressing a key, e.g. F1) that has a list of servers (which we can add to in the code if we ever get more servers we wish people to join easily) where the user only has to click on the server and can join via that menu.

  2. If possible, mod the shop mod NPC’s so that Shop NPC’s can be made to choose and change server. (This would be more suitable for an RP game mode).

Any help with this is appreciated a lot.

Thank you

Meh, your replicating my lobby functionality, but i could make the 1st request, second one i wont have time for. gotta sleep now ( you need to love france )

/sleep ZZZzzzZZZzzz

So you just want a derma menu which lists your servers?

Finished ( couldn’t get round to doing it very fast ) sorry for lateness, rate me late :3:

[LUA]
// Server Viewer
// Made on request by meisno
// protected under the GNU V3 liscense

// I also used derma designer :slight_smile: but only a bit

print( ‘dingusnin is a fail , don’t listen to him if he speaks to you, if you see him in the street, call the police as soon as possible.’ )

if CLIENT then
local servers = { }

servers[ 'Citron Gamers Lobby' ] = { '89.238.160.8:27029' , 'The CitronGamers Official Lobby Server' , true }
// servers[ DISPLAYE NAME ] = { IP , INFO, Fav? }

function ServerMenuAddItem( index , tab )
	servers[ index ] = tab
end

local function OPEN_MENU()

	local Info
	local DTree1
	local DFrame1

	DFrame1 = vgui.Create('DFrame')
	DFrame1:SetSize(538, 350)
	DFrame1:Center()
	DFrame1:SetTitle('Server Connection')
	DFrame1:SetSizable(true)
	DFrame1:SetDeleteOnClose(false)
	DFrame1:MakePopup()

	DTree1 = vgui.Create('DTree')
	DTree1:SetParent(DFrame1)
	DTree1:SetSize(268, 321)
	DTree1:SetPos(4, 26)

	Info = vgui.Create('DPanel')
	Info:SetParent(DFrame1)
	Info:SetSize(257, 319)
	Info:SetPos(276, 27)

	local DButton1
	local DLabel4
	local DLabel3
	local DLabel1
	
	DLabel1 = vgui.Create('DLabel')
	DLabel1:SetParent(Info)
	DLabel1:SetPos(9, 18)
	DLabel1:SetText('Name : ')
	DLabel1:SizeToContents()

	DLabel3 = vgui.Create('DLabel')
	DLabel3:SetParent(Info)
	DLabel3:SetPos(11, 55)
	DLabel3:SetText('Info : ')
	DLabel3:SizeToContents()

	DLabel4 = vgui.Create('DLabel') 
	DLabel4:SetParent(Info)
	DLabel4:SetPos(9, 119)
	DLabel4:SetText('IP :')
	DLabel4:SizeToContents()

	DButton1 = vgui.Create('DButton')
	DButton1:SetParent(Info)
	DButton1:SetSize(139, 33)
	DButton1:SetPos(98, 227)
	DButton1:SetText('Connect')
	DButton1.DoClick = function() end

	
	local Favorites = DTree1:AddNode( 'Favorite Servers' )
	Favorites.Icon:SetImage( 'gui/silkicons/heart' )
	local All_Servers = DTree1:AddNode( 'All Servers' )
	All_Servers.Icon:SetImage( 'gui/silkicons/folder_go' )
	
	for k,v in pairs( servers ) do
		local ip = v[1]
		local info = v[2]
		local fav = v[3]
		if fav == true then
			local e1 = Favorites:AddNode( k )
			e1.Icon:SetImage( "gui/silkicons/world" )
			local e2 = All_Servers:AddNode( k )
			e2.Icon:SetImage( "gui/silkicons/world" )
			
			function e1:DoClick()
				DLabel1:SetText( 'Name : ' .. k )
				DLabel1:SizeToContents()
				DLabel3:SetText( 'Info : ' .. info)
				DLabel3:SizeToContents()
				DLabel4:SetText( 'IP : ' .. ip )
				DLabel4:SizeToContents()
				DButton1.DoClick = function() LocalPlayer():ConCommand( 'connect ' .. ip ) end
			end
			
			function e2:DoClick()
				DLabel1:SetText( 'Name : ' .. k )
				DLabel1:SizeToContents()
				DLabel3:SetText( 'Info : ' .. info)
				DLabel3:SizeToContents()
				DLabel4:SetText( 'IP : ' .. ip )
				DLabel4:SizeToContents()
				DButton1.DoClick = function() LocalPlayer():ConCommand( 'connect ' .. ip ) end
			end
		else
			local e1 = All_Servers:AddNode( k )
			e1.Icon:SetImage( "gui/silkicons/world" )
			function e1:DoClick()
				DLabel1:SetText( 'Name : ' .. k )
				DLabel1:SizeToContents()
				DLabel3:SetText( 'Info : ' .. info)
				DLabel3:SizeToContents()
				DLabel4:SetText( 'IP : ' .. ip )
				DLabel4:SizeToContents()
				DButton1.DoClick = function() LocalPlayer():ConCommand( 'connect ' .. ip ) end
			end
		end
	end
	
end
	
concommand.Add( 'OpenServerList' , OPEN_MENU )

end

if SERVER then
AddCSLuaFile( ‘autorun/hello.lua’ )
end

[/LUA]

place in ‘garrysmod/garrysmod/lua/autorun/hello.lua’ on your server

http://img84.imageshack.us/img84/509/gmconstruct0020.jpg

you forgot to say that i help u with the e1.Icon:SetImage( “gui/silkicons/world” ) end that you partialy used derma designer (program to help make derma)

No you didn’t help me, and yes, i did use DD partially, but not alot and i edited the code alot anyways after. Don’t take credit for stuff you havn’t done

you aked me how to do it , i told you , add me in credits , and edit your post to include DD that you admited using.

your just a troll, and a lying one at that. Get a life and stop trying to get into the creds of something good that you didnt make.

Just to clarify, dingusnin here downloaded wire mod and thinks he should be in the credits just because of that :V trolololol fail

Wauw man. “Icon:SetImage( “gui/silkicons/world” )” You did that? Excellent.

By the way “Icon:SetImage( “gui/silkicons/world” ) end” is wrong.

And I dont see anywhere, that you have to credit using Derma Designer.

this! exactly this ! oh and i did credit DermaDesigner anyway :buddy: