Chat Filter v0.4 (2/27)
NOTE: VERSION 0.3 REQUIRES SOURCEMOD 1.1!
Chat Filter is a configurable chat text filter that I created after looking for a more flexible and entertaining version of swear_replacement.
Chat Filter operates in three modes - replace the entire message with another phrase, censor just the keyword with another word/phrase, or block the message entirely (similar to other censor plugins). Where Chat Filter excels is its configurability:
- Keywords and replacements can be grouped together, so you can create context-specific replacements. For example, you could set it to replace any anti-gay comments with "I quite enjoyed the locker room scenes in Top Gun."
- Keywords can trigger other actions in addition to the normal replacement/blocking. For example, users can be automatically kicked, banned, set on fire, etc. when they trigger certain keywords.
- Chat Filter adds a fun "word of the day" mode, where any user that types the word in chat gets a configurable command executed on them.
The original goal of this plugin was as much to provide amusement for players/admins as to block offensive messages, but it is also a very effective chat censor.
See the attached chatfilter.cfg for a configuration example. Note that when operating in mode 1, the "replace" value will replace the entire message, whereas in mode 2 the replace value will only replace the offending word. If no replacement values are specified, "****" will be used.
- Plugin version.
- 1 is on, 0 is off. (default 1)
- 1 for replace, 2 for censor, 3 for block. (default 1)
- Set to 1 to filter admin chat as well. (default 0)
- Set to 1 to filter player names as well. (default 0)
- Maximum number of offenses before an additional action is taken on a player. 0 for off. (default 0)
- The action to take on a player when they reach the repeat offender limit. This can be any SourceMod admin command ("sm_" prefix optional) that takes a user parameter. (default "gag")
sm_chatfilter_setwordoftheday <phrase> <optional:action> <optional:replace>
Changes the "word of the day" (requires a section in chatfilter.cfg called "wordoftheday"). When a user uses this word in chat, the specified action will be executed on them, and their message will be replaced with the specified text.
Deletes the current word of the day.
chatfilter.smx -> addons/sourcemod/plugins/
chatfilter.sp -> addons/sourcemod/scripting/
chatfilter.cfg -> addons/sourcemod/configs/
chatfilter.phrases.txt -> addons/sourcemod/translations/
plugin.chatfilter.cfg (auto-created) -> cfg/sourcemod/
0.1 - Initial release
0.2 - Fixed case-insensitive replacements
- Fixed chat duplication in CS:S
- Added word-only replacement
0.3 - Fixed name replacement for all Orange Box games (using SM 1.1's SetClientInfo()). Due to how name change rate limits work in OB, if the user tries to change their name back to what it originally was, ChatFilter will not be able to change it again for awhile. Due to this issue, if you are concerned about offensive names, it is highly recommended that you set "sm_chatfilter_limit" to something other than 0, and "sm_chatfilter_limit_action" to "kick", which will result in them being kicked almost immediately if they revert to their original offensive name.
0.4 - Various array-length related fixes.
Thanks to Hell Phoenix for his Swear Replacement plugin, which I borrowed a few ideas and pieces of code from.