disabling chat doesn't stop it grabbing the mouse

hi all

I have this code to disable the default chat:



--Disable default chat
local function hidechat( isTeamChat )
	return true
end
hook.Add( "StartChat", "startchat", hidechat )


but it still enables the mouse. How can I stop it doing this?

Cheers :slight_smile:

You could try using that whenever the chat function is called.

I’ve added that line as per the code below but it doesn’t work:



local function type_chat()

		--chat entry box
		local chat_box = vgui.Create("DFrame")
		chat_box:SetTitle("Chat")
		chat_box:SetSize(400,250)
		chat_box:SetPos(10, ScrH() - chat_box:GetTall() - 10)
		chat_box:ShowCloseButton(false)
		chat_box:SetDraggable(false)
		chat_box.Paint = function()
			draw.RoundedBox( 8, 0, 0, chat_box:GetWide(), chat_box:GetTall(), Color( 0, 0, 0, 150 ) )
		end
		chat_box:MakePopup()
		
		--close button
		local b = vgui.Create("DButton", chat_box)
		b:SetText("Close")
		b:SetSize(60,20)
		b:SetPos(chat_box:GetWide() - b:GetWide() - 2, 2 )
		b.DoClick = function()
			chat_box:Close()
			gui.EnableScreenClicker(false)
		end

	end

	--Disable default chat
	local function hidechat( isTeamChat )
		type_chat()
		return true
	end
	hook.Add( "StartChat", "startchat", hidechat )

Anyone? Surely you guys have encountered this before :wink:

-snip- Nevermind, I’m stupid and didn’t read it all the way.

Not sure this is the right way to do it, but try using this hook and this one, to hide the chat completely.

HUDShouldDraw