Version 1.2
by Dores
Note: Tested on CS 1.6 only, but should work for all mods(leaving Modification on Counter-Strike until I'm sure it's for all mods).
Requested here(idea by aNt1).
Description:
This plugin counts how many times every word/sentence that is on a specific list has been said in chat by players.
This plugin also gives admins the option to block certain words and prevent them from appearing in chat. Like Swear-Filters, but simpler.
It will replace the blocked word(s) with another text(defined by a CVar).
Why would you want it in your server?
How to use:I use sank sounds and I want to see which sounds (words) are not used to clear them and reduce the download time for clients. Also I want to use it to see which swears are used often or if a certain way to avoid gag from this plugin is used often so I'll add it to blacklist.
Go to addons/amxmodx/configs and create there a folder and call it: "words_counter". In it, create two files:
words_counter.ini
blocked_words.ini
In words_counter.ini, put the words(or sentences) that you want the plugin to count.
Example of words_counter.ini:
After a few days with the plugin on, the file should look like so:lol
/rank
/top15
"This is a sentence"
"This is a sank sound"
"This is a swear"
Sw34r
blocked_words.ini should look the same as words_counter.ini:lol 74
/rank 116
/top15 200
"This is a sentence" 57
"This is a sank sound" 23
"This is a swear" 0
Sw34r 1500
Console Commands:blocked
sw34r
lol
can't
nope
Note: All commands can be used by an admin with a ADMIN_CHAT flag.
amx_words_block <word> <[un]block> <temp> - Blocks/Unblocks a word from appearing in chat(a replacement will be shown set by a CVar). If temp is 1, it will not save the word to the blocked words file and will not be blocked after server restart/map change or when unblocked. To block a complete sentence, wrap the sentence with quotes("). Example: amx_words_block "hello, sir" 1 1.
amx_words_clear - Clears the blocked words list(and temporarily blocked words).
amx_words_count <word> <case sensitive> - Shows how many times 'word' have been said according to words_counter.ini. If case sensitive is 1, 'word' must be same as the word in words_counter.ini upper and lower cases wise. This is good to know which words should be blocked without constantly minimizing the game and checking the file.
CVars:
words_counter_chat [Default: 1] - If set to 0, the plugin won't count words/sentences.
words_counter_case [Default: 0] - If set to 1, the words that are being said must be exactly like the words in the file.
sentences_counter_case [Default: 0] - If set to 1, the sentences that are being said must be exactly like the sentences in the file.
words_blocked_case [Default: 0] - Same as [words|sentences]_counter_case, but for blocked words.
words_blocked_replace [Default: [*WORD REMOVED*]] - Set the replacement text instead of blocked words. To put nothing, use it in the following format: words_blocked_replace "" (use empty "quotes").
Installation:
Click the Get Plugin button(or Get Source to get the .sma), and save the .amxx file at addons/amxmodx/plugins(if you pressed Get Source, drag the .sma file to amxxpc.exe which is located at addons/amxmodx/scripting).
Go to amxmodx/configs and open plugins.ini.
Type in it: words_counter.amxx debug (Note: you should put the file at the top of the list to decrease possible lags).
Your plugins.ini should finally look like this:
Credits:words_counter.amxx debug
other_plugin.amxx
another_plugin.amxx debug
another_one.amxx
...
last_plugin.amxx debug
aNt1 - Idea.
DanielKZA - Showed how to find a word inside a string.
To do:
Add more options for replacement text for blocked words.
plugin
source