--[[
     ____                       ________  ______
    / __ \____  ____  ____     / ____/ / / /  _/
   / /_/ / __ \/ __ \/ __ \   / / __/ / / // /  
  / ____/ /_/ / /_/ / /_/ /  / /_/ / /_/ // /   
 /_/    \____/ .___/\____/   \____/\____/___/   
            /_/                                 
     ____            ______                             ______             
    / __ ) __  __   / ____/__  __ ____   ____   __  __ / ____/____   ____  
   / __  |/ / / /  / /_   / / / // __ \ / __ \ / / / // /    / __ \ / __ \ 
  / /_/ // /_/ /  / __/  / /_/ // / / // / / // /_/ // /___ / /_/ // /_/ / 
 /_____/ \__, /  /_/     \__,_//_/ /_//_/ /_/ \__, / \____/ \____// .___/  
        /____/                               /____/              /_/       

 Simplified GUI for ULX Plus TTT Commands
 Version 2.5.4
 
 Installation: 
	Dedicated Servers: Place inside of /gmod/garrysmod/lua/autorun
	Listen Servers: Place inside of /garrysmod/garysmod/lua/autorun
	Clients: Place inside of /garrysmod/garysmod/lua
 
 Usage: pgui
--]]

//This starts a simple bug/load checker.
//Upon seeing "Loaded Popo GUI v3.5.2 By FunnyCop", the script loaded correctly.
-- Start Load Checker Part 1
local Pgui = {}
	Pgui.Message = function(...)
        chat.AddText(Color(50, 255, 100), "Loaded Popo GUI v3.5.2 ", ...)
	end
-- End Load Checker Part 1

//Pgui is run as a console command
//The GUI won't appear by opening the script in the console
//You must use "pgui"
-- Start Function Popo GUI
function run()
	
//Everything is a child of the "Main Frame"
-- Start Main Frame
local Form = vgui.Create( "DFrame" )
	Form:SetPos( 5, 5 )
	Form:SetSize( 406, 301 )
	Form:SetTitle( "Popo GUI v3.5.2" )
	Form:SetVisible( true )
	Form:SetDraggable( true )
	Form:ShowCloseButton( true )
	Form:MakePopup()
	function Form:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end

-- End Main Frame

-- Start Button For "MOTD"
local motd = vgui.Create( "DButton" )
	motd:SetPos( 187, 3 )
	motd:SetText( "Motd" )
	motd:SetSize( 60, 20 )
	motd:SetParent( Form )
	motd.DoClick = function()
		RunConsoleCommand( "ulx", "motd" )
	end
-- End Button For "MOTD"

-- Start Button For "Xgui"
local DButton = vgui.Create( "DButton" )
	DButton:SetPos( 250, 3 )
	DButton:SetText( "Xgui" )
	DButton:SetSize( 60, 20 )
	DButton:SetParent( Form )
	DButton.DoClick = function()
		RunConsoleCommand( "xgui" )
	end
-- End Button For "Xgui"	
	
-- Start Category List #1
local CatList = vgui.Create( "DCategoryList" )
	CatList:SetPos( 3, 26 )
	CatList:SetSize( 200, 272 )
	CatList:SetParent( Form )
-- End Category List #1

-- Start Items Included In Category List #1
	
-- Start Category "Slays"
local slays = CatList:Add( "Slays" )
	slays:SetParent( CatList )
	function slays:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 204, 204, 204) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end
-- End Category "Slays"

-- Start Frame "Single Slay"
local slay = vgui.Create( "DFrame", CatList )
	slay:SetTitle( "Single Slay" )
	slay:SetTall( 54 )
	slay:ShowCloseButton( false )
	CatList:AddItem( slay )
	slay:SetParent( slays )
	function slay:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame "Single Slay
	
-- Start Text Entry Box For "Single Slay"
local slayname = vgui.Create( "DTextEntry", frame )
	slayname:SetParent( slay )
	slayname:SetPos( 3, 26 )
	slayname:SetSize( 191, 25 )
	slayname:SetText( "[Name]" )
	slayname.OnEnter = function( self )
		RunConsoleCommand( "ulx", "slay", self:GetValue() )
	end
-- End Text Entry Box For "Single Slay"

-- Start Frame For "Multiple Slays"
local slaynr = vgui.Create( "DFrame", CatList )
	slaynr:SetTitle( "Multiple Slays" )
	slaynr:SetTall( 54 )
	slaynr:ShowCloseButton( false )
	CatList:AddItem( slaynr )
	slaynr:SetParent( slays )
	function slaynr:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Multiple Slays"

-- Start Text Entry For "Multiple Slays"
local slaynrname = vgui.Create( "DTextEntry", frame )
	slaynrname:SetParent( slaynr )
	slaynrname:SetPos( 3, 26 )
	slaynrname:SetSize( 191, 25 )
	slaynrname:SetText( "[Name]" )
	slaynrname.OnEnter = function( n )
		local rframe = vgui.Create( "DFrame" )
			rframe:Center()
			rframe:SetSize( 103, 54 )
			rframe:SetTitle( "" )
			rframe:SetVisible( true )
			rframe:SetDraggable( true )
			rframe:ShowCloseButton( true )
			rframe:MakePopup()
			function rframe:Paint( w, h )
				draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
				surface.SetDrawColor( 0, 0, 0 )
				surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
			end
		local rounds = vgui.Create( "DTextEntry", rframe )
			rounds:SetParent( rframe )
			rounds:SetPos( 3, 26 )
			rounds:SetSize( 97, 25 )
			rounds:SetText( "[Rounds]" )
			rounds.OnEnter = function( r )
				RunConsoleCommand( "ulx", "slaynr", n:GetValue(), r:GetValue() )
			end
	end
-- End Text Entry For "Multiple Slays"

--End Text Entry

-- Start Category "Bans"
local bans = CatList:Add( "Bans" )
	bans:SetParent( CatList )
	function bans:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 204, 204, 204) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end
-- End Category "Bans"

-- Start Frame For "Ban Name"
local ban = vgui.Create( "DFrame", CatList )
	ban:SetTitle( "Ban Name" )
	ban:SetTall( 54 )
	ban:ShowCloseButton( false )
	CatList:AddItem( ban )
	ban:SetParent( bans )
	function ban:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Ban Name"

-- Start Text Entry For "Ban Name"
local banname = vgui.Create( "DTextEntry", frame )
	banname:SetParent( ban )
	banname:SetPos( 3, 26 )
	banname:SetSize( 191, 25 )
	banname:SetText( "[Name]" )
	banname.OnEnter = function( n )
		local bframe = vgui.Create( "DFrame" )
			bframe:Center()
			bframe:SetSize( 103, 54 )
			bframe:SetTitle( "" )
			bframe:SetVisible( true )
			bframe:SetDraggable( true )
			bframe:ShowCloseButton( true )
			bframe:MakePopup()
				function bframe:Paint( w, h )
					draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
					surface.SetDrawColor( 0, 0, 0 )
					surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
				end
		local bfs = vgui.Create( "DTextEntry", bframe )
			bfs:SetParent( bframe )
			bfs:SetPos( 3, 26 )
			bfs:SetSize( 97, 25 )
			bfs:SetText( "[Minutes]" )
			bfs.OnEnter = function( m )
				local bframe2 = vgui.Create( "DFrame" )
					bframe2:Center()
					bframe2:SetSize( 103, 54 )
					bframe2:SetTitle( "" )
					bframe2:SetVisible( true )
					bframe2:SetDraggable( true )
					bframe2:ShowCloseButton( true )
					bframe2:MakePopup()
						function bframe2:Paint( w, h )
							draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
							surface.SetDrawColor( 0, 0, 0 )
							surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
						end
				local banm = vgui.Create( "DTextEntry", bframe2 )
					banm:SetParent( bframe2 )
					banm:SetPos( 3, 26 )
					banm:SetSize( 97, 25 )
					banm:SetText( "[Reason]" )
					banm.OnEnter = function( r )
							RunConsoleCommand( "ulx", "ban", n:GetValue(), m:GetValue(), r:GetValue() )
					end
			end
	end
-- End Text Entry For "Ban Name"

-- Start Frame For "Ban ID"
local banid = vgui.Create( "DFrame", CatList )
	banid:SetTitle( "Ban ID" )
	banid:SetTall( 54 )
	banid:ShowCloseButton( false )
	CatList:AddItem( banid )
	banid:SetParent( bans )
	function banid:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Ban ID"

-- Start Text Entry For "Ban ID"
local banidt = vgui.Create( "DTextEntry", frame )
	banidt:SetParent( banid )
	banidt:SetPos( 3, 26 )
	banidt:SetSize( 191, 25 )
	banidt:SetText( "[ID]" )
	banidt.OnEnter = function( n )
		local bframei = vgui.Create( "DFrame" )
			bframei:Center()
			bframei:SetSize( 103, 54 )
			bframei:SetTitle( "" )
			bframei:SetVisible( true )
			bframei:SetDraggable( true )
			bframei:ShowCloseButton( true )
			bframei:MakePopup()
				function bframei:Paint( w, h )
					draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
					surface.SetDrawColor( 0, 0, 0 )
					surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
				end
		local bfsi = vgui.Create( "DTextEntry", bframei )
			bfsi:SetParent( bframei )
			bfsi:SetPos( 3, 26 )
			bfsi:SetSize( 97, 25 )
			bfsi:SetText( "[Minutes]" )
			bfsi.OnEnter = function( m )
				local bframei2 = vgui.Create( "DFrame" )
					bframei2:Center()
					bframei2:SetSize( 103, 54 )
					bframei2:SetTitle( "" )
					bframei2:SetVisible( true )
					bframei2:SetDraggable( true )
					bframei2:ShowCloseButton( true )
					bframei2:MakePopup()
						function bframei2:Paint( w, h )
							draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
							surface.SetDrawColor( 0, 0, 0 )
							surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
						end
				local banmi = vgui.Create( "DTextEntry", bframei2 )
					banmi:SetParent( bframei2 )
					banmi:SetPos( 3, 26 )
					banmi:SetSize( 97, 25 )
					banmi:SetText( "[Reason]" )
					banmi.OnEnter = function( r )
							RunConsoleCommand( "ulx", "banid", n:GetValue(), m:GetValue(), r:GetValue() )
					end
			end
	end
-- End Text Entry For "Ban ID"

-- End Items Included In Category List #1

-- Start Category List #2
local CatList2 = vgui.Create( "DCategoryList" )
	CatList2:SetPos( 203, 26 )
	CatList2:SetSize( 200, 272 )
	CatList2:SetParent( Form )
-- End Category List #2

-- Start Items Included In Category List #2

-- Start Category For "Spectator Controls"
local spec = CatList:Add( "Spectator Controls" )
	spec:SetParent( CatList2 )
	function spec:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 204, 204, 204) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end
-- End Category For "Spectator Controls"

-- Start Frame For "Force Spectator"
local fspec = vgui.Create( "DFrame", CatList2 )
	fspec:SetTitle( "Force Spectator" )
	fspec:SetTall( 54 )
	fspec:ShowCloseButton( false )
	CatList2:AddItem( spec )
	fspec:SetParent( spec )
	function fspec:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- Start Frame For "Force Spectator"

-- Start Text Input For "Force Spectator"
local fspect = vgui.Create( "DTextEntry", frame )
	fspect:SetParent( fspec )
	fspect:SetPos( 3, 26 )
	fspect:SetSize( 191, 25 )
	fspect:SetText( "[Name]" )
	fspect.OnEnter = function( self )
	RunConsoleCommand( "ulx", "fspec", self:GetValue() )
	end
-- End Text Input For "Force Spectator"

-- Start Frame For "UnSpectate"
local funafk = vgui.Create( "DFrame", CatList2 )
	funafk:SetTitle( "UnSpectate" )
	funafk:SetTall( 54 )
	funafk:ShowCloseButton( false )
	CatList2:AddItem( spec )
	funafk:SetParent( spec )
	function funafk:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "UnSpectate"

-- Start Text Input For "UnSpectate"
local funafkt = vgui.Create( "DTextEntry", frame )
	funafkt:SetParent( funafk )
	funafkt:SetPos( 3, 26 )
	funafkt:SetSize( 191, 25 )
	funafkt:SetText( "[Name]" )
	funafkt.OnEnter = function( self )
	RunConsoleCommand( "ulx", "unspec", self:GetValue() )
	end
-- End Text Entry For "UnSpectate"

-- Start Frame For "Spectate Player"
local sp = vgui.Create( "DFrame", CatList2 )
	sp:SetTitle( "Spectate Player" )
	sp:SetTall( 54 )
	sp:ShowCloseButton( false )
	CatList2:AddItem( sp )
	sp:SetParent( spec )
	function sp:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Spectate Player"

-- Start Text Input For "Spectate Player"
local spt = vgui.Create( "DTextEntry", frame )
	spt:SetParent( sp )
	spt:SetPos( 3, 26 )
	spt:SetSize( 191, 25 )
	spt:SetText( "[Name]" )
	spt.OnEnter = function( self )
	RunConsoleCommand( "ulx", "spectate", self:GetValue() )
	end
-- End Text Input For "Spectate Player"

-- Start Category For "Server Information"
local ui = CatList:Add( "Server Information" )
	ui:SetParent( CatList2 )
	function ui:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 204, 204, 204) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end
-- End Category For "Server Information"

-- Start Frame For "Status"
local cu = vgui.Create( "DFrame", CatList2 )
	cu:SetTitle( "Status" )
	cu:SetTall( 54 )
	cu:ShowCloseButton( false )
	CatList2:AddItem( cu )
	cu:SetParent( ui )
	function cu:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Status"

-- Start Button For "Run Status"
local who = vgui.Create( "DButton" )
	who:SetPos( 3, 26 )
	who:SetText( "Run Status" )
	who:SetSize( 191, 25 )
	who:SetParent( cu )
	who.DoClick = function()
		RunConsoleCommand( "status" )
	end
--End Button For "Run Status"

-- End Items Included In Category List #2

-- Start "Chat Functions" Frame
local chat = vgui.Create( "DFrame" )
	chat:SetPos( 414, 5 )
	chat:SetSize( 206, 220 )
	chat:SetParent( Form )
	chat:SetTitle( "Chat Functions" )
	chat:SetVisible( true )
	chat:SetDraggable( true )
	chat:ShowCloseButton( true )
	chat:MakePopup()
	function chat:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end
-- End "Chat Functions" Frame

-- Start Category List #3
local CatList3 = vgui.Create( "DCategoryList" )
	CatList3:SetPos( 3, 26 )
	CatList3:SetSize( 200, 191 )
	CatList3:SetParent( chat )
-- End Category List #3

-- Start Items Included In Category #3

-- Start "Special Chat" Category
local schat = CatList:Add( "Special Chat" )
	schat:SetParent( CatList3 )
	function schat:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 204, 204, 204) )
		surface.SetDrawColor( 0, 0, 0 )
		surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
	end
-- End "Special Chat" Category

-- Start Frame For "Admin Chat"
local ac = vgui.Create( "DFrame", CatList3 )
	ac:SetTitle( "Admin Chat" )
	ac:SetTall( 54 )
	ac:ShowCloseButton( false )
	CatList2:AddItem( ac )
	ac:SetParent( schat )
	function ac:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Admin Chat"

-- Start Text Input For "Admin Chat"
local act = vgui.Create( "DTextEntry", ac )
	act:SetParent( ac )
	act:SetPos( 3, 26 )
	act:SetSize( 191, 25 )
	act:SetText( "[Message]" )
	act.OnEnter = function( self )
		RunConsoleCommand( "ulx", "asay", self:GetValue() )
	end
-- End Text Input For "Admin Chat"

-- Start Frame For "Center Chat"
local cc = vgui.Create( "DFrame", CatList3 )
	cc:SetTitle( "Center Chat" )
	cc:SetTall( 54 )
	cc:ShowCloseButton( false )
	CatList2:AddItem( cc )
	cc:SetParent( schat )
	function cc:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Center Chat"

-- Start Text Input For "Center Chat"
local cct = vgui.Create( "DTextEntry", cc )
	cct:SetParent( cc )
	cct:SetPos( 3, 26 )
	cct:SetSize( 191, 25 )
	cct:SetText( "[Message]" )
	cct.OnEnter = function( self )
		RunConsoleCommand( "ulx", "csay", self:GetValue() )
	end
-- End Text Input For "Center Chat"

-- Start Frame For "Private Chat"
local pc = vgui.Create( "DFrame", CatList3 )
	pc:SetTitle( "Private Chat" )
	pc:SetTall( 54 )
	pc:ShowCloseButton( false )
	CatList2:AddItem( pc )
	pc:SetParent( schat )
	function pc:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
	end
-- End Frame For "Private Chat"

-- Start Text Entry For "Private Chat"
local pct = vgui.Create( "DTextEntry", pc )
	pct:SetParent( pc )
	pct:SetPos( 3, 26 )
	pct:SetSize( 191, 25 )
	pct:SetText( "[Name]" )
	pct.OnEnter = function( self )
		local pctf = vgui.Create( "DFrame" )
			pctf:Center()
			pctf:SetSize( 103, 54 )
			pctf:SetTitle( "" )
			pctf:SetVisible( true )
			pctf:SetDraggable( true )
			pctf:ShowCloseButton( true )
			pctf:MakePopup()
				function pctf:Paint( w, h )
					draw.RoundedBox( 0, 0, 0, w, h, Color( 1, 1, 1) )
					surface.SetDrawColor( 0, 0, 0 )
					surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
				end
		local pctt = vgui.Create( "DTextEntry", bframei )
			pctt:SetParent( pctf )
			pctt:SetPos( 3, 26 )
			pctt:SetSize( 97, 25 )
			pctt:SetText( "[Message]" )
			pctt.OnEnter = function( m )
				RunConsoleCommand( "ulx", "psay", self:GetValue(), m:GetValue() )
			end
	end
-- End Text Entry For "Private Chat"

-- End Items In Category #3

end
-- End Function Popo GUI

-- Start Load Checker Part 2
Pgui.Message( "By FunnyCop" )
-- End Load Checker Part 2

//This creates the console command pgui that makes the GUI appear on screen
concommand.Add( "pgui", run )