--[[
	lua/helper.lua
	Tyguy-garry denied my friendinv | (STEAM_0:1:13142739)
	===DStream===
]]

--[[
	Helper Bot: An easy interface
	Made by Tyguy (550)
	Do not modify or redistribute.
--]]

local Chat_C = 
{

}

local chat_lines = 1
HelperBox = vgui.Create("DFrame")
HelperBox:SetPos(ScrW()/2.8, ScrH()/4)
HelperBox:SetSize(700, 600)
HelperBox:SetTitle("Helper Bot")
HelperBox:SetDraggable(false)
HelperBox:ShowCloseButton(true)
HelperBox:MakePopup()

	function HelperBox:Paint()
	draw.RoundedBox(2, 0, 0, 700, 600, Color(0, 0, 0, 255))
	end

HelperBoxForEntry = vgui.Create("DFrame")
HelperBoxForEntry:SetPos(ScrW()/2.8, ScrH()/1.2)
HelperBoxForEntry:SetSize(700, 100)
HelperBoxForEntry:SetTitle("")
HelperBoxForEntry:SetDraggable(false)
HelperBoxForEntry:ShowCloseButton(true)
HelperBoxForEntry:MakePopup()

	function HelperBoxForEntry:Paint()
	draw.RoundedBox(2, 0, 0, 700, 100, Color(0, 0, 0, 255))
	end

HelperBoxText = vgui.Create("DLabel", HelperBox)
HelperBoxText:SetPos(5, 10)
HelperBoxText:SetFont("ChatFont")
HelperBoxText:SetTextColor(Color(255, 255, 255, 255))
HelperBoxText:SetText("Welcome to Helper Bot v1.0. How may I assist you?")
HelperBoxText.TimeOn = CurTime() + 5
HelperBoxText:SizeToContents()
HelperBoxText:Dock(TOP)

HelperBoxTextEntry = vgui.Create("DTextEntry", HelperBoxForEntry)
HelperBoxTextEntry:SetPos(5, 30)
HelperBoxTextEntry:SetWide(690)

	function HelperBoxTextEntry:OnEnter()
	local enteredtext = HelperBoxTextEntry:GetText()
	AddText(255, 255, 255, 255, "> "..enteredtext)
		if enteredtext == "list players" then
		AddText(255, 255, 255, 255, "Players Online: "..#player.GetAll())
		end
	HelperBoxTextEntry:SetText("")
	end

function AddText(r, g, b, a, text)
new_line = chat_lines + 1
table.insert(Chat_C, {new_line, CurTime() + 5})
PrintTable(Chat_C)
HelperBoxText[new_line] = vgui.Create("DLabel", HelperBox)	
HelperBoxText[new_line]:SetPos(5, 10)
HelperBoxText[new_line]:SetFont("ChatFont")
HelperBoxText[new_line]:SetTextColor(Color(r, g, b, a))
HelperBoxText[new_line]:SetText(text)
HelperBoxText[new_line]:SizeToContents()
HelperBoxText[new_line]:Dock(TOP)
end

hook.Add("Think", "HelperBox_Text_Fade", function()
	if IsValid(HelperBox) and IsValid(HelperBoxText[chat_lines]) then
		for k,v in pairs(Chat_CC) do
			if IsValid(HelperBoxText[v[1]]) then
				if CurTime() >= v[2] then
				HelperBoxText[v[1]]:Remove()
				chat_lines = chat_lines - 1
				end
			end
		end
	end
end )