Raised This Month: $ Target: $400
 0% 

Load ban.cfg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nnajko
Senior Member
Join Date: May 2009
Location: Sweden
Old 05-26-2015 , 19:25   Re: Load ban.cfg
Reply With Quote #1

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( 
<= id <= 32 )
    {
        new 
ip[64];
        
get_user_ip(idipcharsmax(ip), true);
        
check_ip(ip);
    }
}

public 
check_ip(ip[64])
{
    if( !
file_exists(ban_file) )
        return;
        
    new 
line 0data[128], length;
    while( 
read_file(ban_filelinedatacharsmax(data), length) != 0)
    {
        if( 
equal(ipdata) )
        {
            
server_cmd("amx_addban %s 0"ip);
            break;
        }
        
        
line++;
        }

Edit this to your liking.
PHP Code:
server_cmd("amx_addban %s 0"ip); 

Last edited by nnajko; 05-26-2015 at 19:30.
nnajko is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 09-12-2015 , 07:28   Re: Load ban.cfg
Reply With Quote #2

Quote:
Originally Posted by nnajko View Post
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( 
<= id <= 32 )
    {
        new 
ip[64];
        
get_user_ip(idipcharsmax(ip), true);
        
check_ip(ip);
    }
}

public 
check_ip(ip[64])
{
    if( !
file_exists(ban_file) )
        return;
        
    new 
line 0data[128], length;
    while( 
read_file(ban_filelinedatacharsmax(data), length) != 0)
    {
        if( 
equal(ipdata) )
        {
            
server_cmd("amx_addban %s 0"ip);
            break;
        }
        
        
line++;
        }

Edit this to your liking.
PHP Code:
server_cmd("amx_addban %s 0"ip); 
Thank , i use Advanced bans, and sometimes player get ban from server (flood) so this code will show they ip on ban.cfg?
__________________
Қазақстан Республикасы
Snitch is offline
Send a message via Skype™ to Snitch
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode