Chat box

Hey guys,

Can’t search, tried google and no use, checked out the wiki and all that but thought I’d just post here and see if I can get any help.

I’m wanting to make a custom chat box, where to start? The only thing I have got so far is:

local function StartChat(TeamSay)
	return true
hook.Add("StartChat", "HideChatBox", StartChat)

Which hides the default chat box.

Any help/code snippets would be appreciated.


Excuse me if this is dumb, but can someone please explain to me how and why someone would name a function StartChat, if it hides a chatbox? Also if it’s hiding it why would you return true?

I thought the same thing,

Why is sending something via boat called CARgo?

Why is sending something via car called a SHIPment?

return true to hide the chatbox, return false = don’t hide chatbox… duh?

It gets called when the player opens the chatbox and since garry did not want 2 hooks he put the hiding into that one. - Have fun (Should be a good example)

Great, thats exactly what I was looking for, thanks man.

It’s called when the chatbox is opened. Returning true blocks the default chatbox from opening. So before returning you’d call the function to open your chatbox.

That makes sense. Just seems more logical to make a ChatShouldDraw hook, or something like that.