check out your amx_addban workablility.
and also note: readnng file every time when user connects is really efficienlty, better to use global variable(like a array). and on initilization just once read file and put all variables inside arrays.
and also, I hope you understand that this plugin check only class mask? for example they get only first digits from ip(~9/10symbols} xxx.xxx.xxx=11 ..
i think better to check only substring from all ip. for example:
you get ip
get_user_ip(id,ip,31,1)
/* Checks if two strings equal. If len var is set
* then there are only c chars comapred. */
native equal(const a[],const b[],c=0);
PHP Code:
public mSoftVerificaClasaDeIp(id)
{
if(is_user_connected(id) == 1)
{
new user[32],ip[32];
get_user_name(id,user,31)
get_user_ip(id,ip,31,1)
new counterIpuri;
counterIpuri = 0
new f = fopen("/addons/amxmodx/configs/msoft_blacklist.ini","r")
new data[128]
while( !feof(f) )
{
fgets(f, data, 127)
if(data[0] != ';')
{
counterIpuri++;
}
}
fclose(f)
new fisierBlackList[128],clasaIpB[32];
format(fisierBlackList, 127, "/addons/amxmodx/configs/msoft_blacklist.ini")
for (new i=0; i<counterIpuri; i++)
{
read_file(fisierBlackList, i, clasaIpB, 31, t)
//replace_all(clasaIpA, 9, ".", "")
//replace_all(clasaIpB, 9, ".", "")
if (equal(ip, clasaIpA,11))
{
//remove server_print when tested.
server_print("11symbols of %s is equal to %s, so banning");
set_task(5.0,"mSoftAdaugaBanPermanent",id)
client_print(id,print_chat,"[info] Ops.. %s se pare ca ai fost pedepsit de catre conducerea acestui server. BAN PERMANENT pe CLASA de IP!",user)
client_print(id,print_chat,"[info] In cazul in care consideri ca aceasta pedeapsa este un abuz, asteptam reclamatia pe forum: http://counterstrike.master-software.ro")
}
}
}
}
and also add server_print to banning, to check what server send with amx_addban.
PHP Code:
public mSoftAdaugaBanPermanent(id)
{
if(is_user_connected(id) == 1)
{
new szName[32],ip[32];
get_user_name(id,szName,31)
get_user_ip(id,ip,31,1)
server_cmd("amx_addban ^"%s^" ^"%s^" 0 ^"Your Ip Has Been Blacklisted - Headshooter^"",szName,ip)
server_print("trying to amx_addban ^"%s^" ^"%s^" 0 ^"Your Ip Has Been Blacklisted - Headshooter^"",szName,ip)
client_print(0,print_chat," %s has been banned from server - Headshooter Bans! ",szName)
}
}
__________________