• CensorModule/Addon!
    10 replies, posted
Could anyone possibly code a word censor mod/addon?
Sure! Message me and we can talk out the details. Steam: worlduser753
Infact, a simple censor addon is just a huge blacklist with either patterns or normal words. Infact, I wrote something that automaticly fixes grammar and uses a grammar points system (similar to smartness). This could be easily modified to censor I guess.
All you would have to do is string.Explode the chat message, check each part to with a massive blacklist table, then if it is bad, string.Replace it with a cleaner version, that is the value of the blacklist table.
[QUOTE=CmdrMatthew;32885099]All you would have to do is string.Explode the chat message, check each part to with a massive blacklist table, then if it is bad, string.Replace it with a cleaner version, that is the value of the blacklist table.[/QUOTE] string.Replace() is bad. It is a nono. Use string.gsub().
[QUOTE=Mister C;32885432]string.Replace() is bad. It is a nono. Use string.gsub().[/QUOTE] Not quite. string.gsub allows patterns or rather enforces them, string.Replace doesn't use patterns.
[QUOTE=Wizard of Ass;32889410]Not quite. string.gsub allows patterns or rather enforces them, string.Replace doesn't use patterns.[/QUOTE] ya, but I think he was talking in the sense that string.Replace is slower
Also, string.gsub imo works better.
[QUOTE=Mister C;32897611]Also, string.gsub imo works better.[/QUOTE] What do you mean with "works better" it just functions as a non pattern replacer, since not everyone is familar with patterns this is quite a nice function.
[QUOTE=Wizard of Ass;32898754]What do you mean with "works better" it just functions as a non pattern replacer, since not everyone is familar with patterns this is quite a nice function.[/QUOTE] For what I use it for mainly it just works better. :\ I used string.Replace and it broke everything. xD
[url]http://www.garrysmod.org/downloads/?a=view&id=96251[/url] There you go, no need to type up a big lua script this guy has done it all for you.
Sorry, you need to Log In to post a reply to this thread.