| AnHiMiLaToR |
11-03-2007 19:34 |
My AutoBan plugin is not working (based on SwearReplacements)
Please help me!
When I say some word from the ban.ini file it doesn't ban me... :(
Here's the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define MAX_WORDS 200
new g_banWords[MAX_WORDS][200]
new g_banNum
public plugin_init()
{
register_plugin ( "Auto BAN", "1.0", "kaboomkazoom & AnHiMiLaToR")
register_concmd ( "aban_add", "aban_add", ADMIN_LEVEL_A , "" )
readList()
}
readList()
{
new Configsdir[64]
new ban_file[64]
get_configsdir( Configsdir, 63 )
format(ban_file, 63, "%s/ban.ini", Configsdir )
if ( !file_exists(ban_file) )
{
server_print ( "==========================================================" )
server_print ( "[Auto BAN] %s file not found", ban_file )
server_print ( "==========================================================" )
return
}
new len, i=0
while( i < MAX_WORDS && read_file( ban_file, i , g_banWords[g_banNum], 19, len ) )
{
i++
if( g_banWords[g_banNum][0] == ';' || len == 0 )
continue
g_banNum++
}
}
public bancheck(id)
{
new said[192]
read_args ( said, 191 )
new i = 0
while ( i < g_banNum )
{
if ( containi ( said, g_banWords[i++] ) != -1 )
{
new user_name[32]
get_user_name ( id, user_name, 31 )
server_cmd("amx_ban %s 0 ^"[Auto BAN] You have hack. So you got owned! Why you banned: %s^"", user_name, said)
server_cmd("amx_tsay green ^"[Auto BAN] %s banned. He said '%s' which is not permitted or it's a hack^"", user_name, said)
server_cmd("amx_chat ^"[Auto BAN] %s banned. He said '%s' which is not permitted or it's a hack^"", user_name, said)
log_amx("[AUTO BAN] Banned '%s' permanently, he said the denied word(s): %s", user_name, said)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public aban_add(id)
{
if ( ( !(get_user_flags(id)&ADMIN_LEVEL_A) && id ) )
{
client_print ( id, print_console, "[Auto BAN] Access Denied" )
return PLUGIN_HANDLED
}
if ( read_argc() == 1 )
{
client_print ( id, print_console, "[Auto BAN] Arguments not provided" )
return PLUGIN_HANDLED
}
new Configsdir[64]
new ban_file[64]
get_configsdir( Configsdir, 63 )
format ( ban_file, 63, "%s/ban.ini", Configsdir )
read_args ( g_banWords[g_banNum], 19 )
write_file( ban_file, "" )
write_file( ban_file, g_banWords[g_banNum] )
g_banNum++
id ? client_print ( id, print_console, "[Auto BAN] Ban string added to the ini file." ) : server_print ( "[Auto BAN] Ban string added to the ini file." )
return PLUGIN_HANDLED
}
|