Is it possible to make a PlayerSay Like In OnPlayerChat or ChatText to replace Text?

Is it possible to make a PlayerSay Like In OnPlayerChat or ChatText to replace Text?

I have tried but i can’t seem to get it to work, i think i have seen e2 do something similar to what i want replacing some words like exmple to example?

Yes, its easy, thats how i do my chatfilters.

[LUA]

hook.Add(“PlayerSay”, “ChatFilter”, function( ply, text)
local fin = string.gsub( text, “exmple”, “example”)
return fin
end)

[/LUA]

I’m guessing the first example is the word they say, then the second is what you want to replace it with?

Yep **[String.gsub

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=String.gsub)**

No wait i said client-side not server side, learn to read people.

I know how to do it server-side i just need help on client-side…

I don’t see where you said which one you wanted, but what exactly are you asking if not a chat filter?

Is it possible to make a PlayerSay Like for OnPlayerChat or ChatText to replace Text for clientside… NOT serverside.

Oh hmm, I can’t answer that =3

Make your own chatbox, and make a function to do that

Ah i see thanks! :slight_smile:

Return a different value in OnPlayerChat. Was it that hard?


] lua_run_cl hook.Add("OnPlayerChat","Hi",function() return "OMG XD" end )
(SILENT)(ADMIN) 'Seth ran ""say Hello!"" on 'God
'God: Hello!