- - No Swear?
(https://forums.alliedmods.net/showthread.php?t=324008)
Cirovic
05-03-2020 15:34
No Swear?
In this plugin, i added swear "karam" and when someone types "karambit" it detects word.. so can someone please fix this "problem"
fysiks
05-03-2020 17:48
Re: No Swear?
Quote:
Originally Posted by thEsp
(Post 2697982)
At line 156:
Code:
if(containi( said, g_swearWords[i++])!=-1)
->
Code:
if(equali( said, g_swearWords[i++]))
That change would basically break the plugin because it would never detect any of the words that are in sentences. It's called "simple" because it can't take into account a whole lot of variations in words/sentences.
Probably the best option is to use a regex-based version where you can specify word boundaries before and after the word. This will rule out detecting 'bad' words that are wholey contained in a 'no-so-bad' word.
Cirovic
08-30-2020 14:12
Re: No Swear?
bump
fysiks
08-30-2020 16:29
Re: No Swear?
Quote:
Originally Posted by fysiks
(Post 2697983)
Probably the best option is to use a regex-based version where you can specify word boundaries before and after the word. This will rule out detecting 'bad' words that are wholey contained in a 'no-so-bad' word.
its ok now, but can you please edit plugin that when someone swear his msg does not appear and do not alert admins.. thanks
Bugsy
08-30-2020 20:56
Re: No Swear?
Untested
Spoiler
PHP Code:
/* AMX Mod script. * * (c) Copyright 2004, kaboomkazoom * This file is provided as is (no warranties) * * Simple Swear Replacement filter 1.5 * Replaces the chat message containing any * swear word with a replacement line from * replacements.ini * * So anyone who swears will himself be insulted. * * Whenever any message is replaced, then the original * message containing Swears will be shown to all the * Admins (So the Admins know what was said). * * Admin messages are not replaced. So they can Swear ;) * * Uses swearwords.ini and replacements.ini files. * Put these files in the AMX Config Directory. * Other swear files can also be used. * * You can also add Swear Words and Replacement * Lines to the files in between the game whenever * you want. * * * * Console Commands * ~~~~~~~~~~~~~~~~ * * amx_addswear < swear word > - Use this Command in game to add the * swear word in swearwords.ini and start * blocking that word from that moment on. * * amx_addreplacement < replacement line > - Use this command in game to add a new * replacement line in replacements.ini * * * * * P.S. If the number of swear words or replacement * lines exceeds 150 or 50 respectively then change * the values of MAX_WORDS and MAX_REPLACE * * */
#include <amxmodx> #include <amxmisc>
// max number of words in swear list and max number of lines in replace list #define MAX_WORDS 150 #define MAX_REPLACE 50
// global variables for storing the swear list and replace list and their respective number of lines new g_swearWords[MAX_WORDS][20] new g_replaceLines[MAX_REPLACE][192] new g_swearNum new g_replaceNum
public plugin_init() { register_plugin ( "Swear Replacement", "1.5", "kaboomkazoom") register_clcmd ( "say", "swearcheck" ) register_clcmd ( "say_team", "swearcheck" ) register_concmd ( "amx_addswear", "add_swear", ADMIN_LEVEL_A , "< swear word to add >" ) register_concmd ( "amx_addreplacement", "add_replacement", ADMIN_LEVEL_A , "< replacement line to add >" ) readList() }
id ? client_print ( id, print_console, "[Swear Replacement] Swear word added to List" ) : server_print ( "[Swear Replacement] Swear word added to file" )
return PLUGIN_HANDLED }
public add_replacement(id) { if ( ( !(get_user_flags(id)&ADMIN_LEVEL_A) && id ) ) { client_print ( id, print_console, "[Swear Replacement] Access Denied" ) return PLUGIN_HANDLED }
if ( read_argc() == 1 ) { client_print ( id, print_console, "[Swear Replacement] Arguments not provided" ) return PLUGIN_HANDLED }
new Configsdir[64] new replace_file[64] get_configsdir( Configsdir, 63 ) format ( replace_file, 63, "%s/replacements.ini", Configsdir )
id ? client_print ( id, print_console, "[Swear Replacement] Replacement Line added to List" ) : server_print ( "[Swear Replacement] Replacement Line added to file" )
return PLUGIN_HANDLED }
public string_cleaner( str[] ) { new i, len = strlen ( str ) while ( contain ( str, " " ) != -1 ) replace ( str, len, " ", "" )