#include <amxmodx>
#define AUTHOR "aSior - amxx.pl/user/60210-asior/"
new const FilesPath[][] =
{
"addons/amxmodx/configs/unbanips.ini",
"listip.cfg"
};
new INF_LineText[33], INF_Length, INF_DataRead[33];
public plugin_init()
register_plugin("x", "v0.1", AUTHOR);
public plugin_precache()
LoadBansFile();
public LoadBansFile()
{
if(!file_exists(FilesPath[0]))
return;
new LineText[40], length, DataRead[33], OnLine;
for(new i=0; read_file(FilesPath[0], i, LineText, charsmax(LineText), length); i++)
{
if(LineText[0] == '/' || LineText[0] == ';' || !LineText[0] || LineText[0] == ' ')
continue;
parse(LineText, DataRead, charsmax(DataRead));
OnLine = IsInFile(FilesPath[1], DataRead);
if(OnLine > -2)
{
log_amx("Usunieto log (%s) (linia: %i) (plik: %s).", DataRead, OnLine, FilesPath[1]);
write_file(FilesPath[1], "", OnLine);
}
}
}
public IsInFile(FilePath[], string[])
{
for(new i=0; read_file(FilePath, i, INF_LineText, charsmax(INF_LineText), INF_Length); i++)
{
if(INF_LineText[0] == '/' || INF_LineText[0] == ';' || !INF_LineText[0] || INF_LineText[0] == ' ')
continue;
parse(INF_LineText, INF_DataRead, charsmax(INF_DataRead));
if(equal(INF_DataRead, string))
return i;
else
continue;
}
return -2; // -2 bo write_file (line - numer linii pliku, -1 oznacza zapis na końcu.)
}