Cancel chat message

How do I cancel the text in player say from going out in chat?

E.g. do I return something?

Edit:
Well obv I return something, I tried true, false, 1, 0 etc…

Yes, return false or “”

Supposedly (Wiki) returning false crashes the game. I haven’t had such problems.

I believe you do this:


function GM:PlayerSay(ply, text, toall)
	return ""
end

EDIT: Ninjas!

Thanks guys :stuck_out_tongue:

Edit: Someone should update the wiki because it says if you return false a pure virtual error or something will occur :S :stuck_out_tongue:

Probably still does cause such a crash.

I’ve used ‘return false’ alot more than any other method, and it has never crashed me (Or anyone else)

Might be an old section of the wiki - maybe a GMod 9 / EP1 engine problem.

I think if you return anything, false, true, or otherwise, it cancels out any other playersay hooks, so make sure you don’t need that hook elsewhere.

Good point yakahughes. I think this error was from when like Gmod 10 first came out, I remember that pure memory issue a lot around then - else Gmod 9 like someone else said.

Thanks guys though :smiley: