I made this a lot of time ago .
Its not tested , but i think need works .
I have looked a version with tries , but i never understand the tries , and doesn't exist a tutorial , sorry.
Code:
#include <amxmodx>
#include <amxmisc>
#pragma semicolon 0
static const AUTHOR[] = "Luqqas' aka lucas_7_94";
static const PLUGIN[] = "Don't Insult In This Server!";
new const ARCHIVEINI[] = "anti-insult.ini";
#define MAX_WORDS 100
#define REASONKICK "Don't insult in this sv retard"
new szWords[ MAX_WORDS ][ 32 ] ;
new Words;
new const mycvars[][] = { "amx_insult_block" };
new const mycvarsvalor[][] = { "0" };
enum
{
cvar_block_style = 0
}
new Cvars[1];
public plugin_init( )
{
register_plugin( PLUGIN, "1.0c", AUTHOR );
// Hooking the 'say' & 'say_team'
register_clcmd( "say", "Filtersay" );
register_clcmd( "say_team", "Filtersay" );
Cvars[0] = register_cvar(mycvars[cvar_block_style] , mycvarsvalor[cvar_block_style]); // 0 , block the message , 1 , kick.
}
public Filtersay(id)
{
new Args[150];
read_args(Args, 149);
remove_quotes(Args);
trim(Args)
for(new i = 0; i < Words; ++i)
{
if(containi(Args , szWords[i]) != -1)
{
switch(get_pcvar_num(Cvars[0]))
{
case 0:
{
client_print(id, print_chat, "No podes insultar aca")
}
case 1:
{
message_begin( MSG_ONE , SVC_DISCONNECT , _ , id );
write_string( REASONKICK );
message_end( );
client_print(id, print_chat, "funcion llamada")
}
}
}
}
return PLUGIN_CONTINUE
}
public plugin_cfg(){
new szFilename[136];
new szPath[ 64 ];
get_configsdir(szPath, 63);
format(szFilename, 63, "%s/%s",szPath, ARCHIVEINI);
if (file_exists(szFilename))
{
log_amx("Archivo %s ejecutado correctamente",szFilename);
new szData[64], iLen, iPos = 0;
while (Words <= MAX_WORDS && read_file( szFilename, iPos++, szData,63,iLen))
{
if (iLen == 0 || equal(szData, ";", 1))
{
continue;
}
copy(szWords[Words],31, szData)
++Words;
}
}
else
{
log_amx("Archivo %s No encontrado -- Creando...",szFilename);
write_file(szFilename,";Here go you bad words.");
write_file(szFilename,";Made by Lucas_7_94 From Alliedmods.");
write_file(szFilename,";");
write_file(szFilename,"gay");
// Hasta aca
}
}