PHP Code:
#include <amxmodx>
new ban_file[] = "ban.cfg";
public plugin_init()
{
register_plugin("IP Ban", "1.0", "dnk.");
if( !file_exists(ban_file) )
{
write_file(ban_file, "");
}
}
public client_authorized(id)
{
if( 1 <= id <= 32 )
{
new ip[64];
get_user_ip(id, ip, charsmax(ip), true);
check_ip(ip);
}
}
public check_ip(ip[64])
{
if( !file_exists(ban_file) )
return;
new line = 0, data[128], length;
while( read_file(ban_file, line, data, charsmax(data), length) != 0)
{
if( equal(ip, data) )
{
server_cmd("amx_addban %s 0", ip);
break;
}
line++;
}
}
Edit this to your liking.
PHP Code:
server_cmd("amx_addban %s 0", ip);