Chat reverser

I’m looking for a script that takes whatever I say in chat and reverses it if I have a client convar set to 1, for example
In chat:
Input- “Hi I’m M1kep”
Players see in chat box: “Hi I’m M1kep”
Console: reverse_chat 1
Input- “Hi I’m still M1kep”
Players see in chat box: “pek1M llits m’I iH”

Looking for a script if possible thx in advance.




local reverseShit = false
hook.Add("OnPlayerChat", "repeatBackwards", function(ply, text, bt, bp)
	if !reverseShit then return end
	if text and string.len(text) > 1 then RunConsoleCommand("say", string.reverse(text)) end
end)

concommand.Add("reverseShit", function()
	reverseShit = !reverseShit
        print("reverseShit is now: "..tostring(reverseShit))
end)


So will this show both hello and olleh when enabled? Or either hello and when enabled olleh?
And thx!

Wrong rating sorry.
And this can be closed