Code:
#include <amxmodx>
#include <amxmisc>
new configfile[200]
new just_said[33]
public plugin_init()
{
register_plugin("Swear Filter","1.0a","SuicideDog")
register_clcmd("say","swearcheck")
register_clcmd("say_team","swearcheck")
new configsdir[200]
get_configsdir(configsdir,199)
format(configfile,199,"%s/swear/swearwords.ini",configsdir)
}
public swearcheck(id)
{
new text[200]
read_args(text,199)
if(!just_said[id])
{
for(new i=0;i<=file_size(configfile,1)-1;i++)
{
new read[32]
new trash
read_file(configfile,i,read,31,trash)
if((contain(text,read)!=-1))
{
just_said[id]=true
new saytype[32]
new read2[32]
read_file(configfile,i+1,read2,31,trash)
replace(text,199,read,read2)
read_argv(0,saytype,31)
client_cmd(id,"%s %s",saytype,text)
set_task(0.2,"just_didnt_said",id)
return PLUGIN_HANDLED
}
}
}
return PLUGIN_CONTINUE
}
public just_didnt_said(id)
{
just_said[id]=false
return PLUGIN_HANDLED
}
here, this plugin will replace whatever is found in the .ini file with whats on the next line of the .ini file. In Example:
However this version is now case sensitive. If the player types "fuck" instead of "Fuck" it will not catch it. If he types "fucK" it won't catch it either. Etc. Etc.