31.03.2014, 05:45
Quote:
Show AddBan stock. I think you're banning IP on each of these commands..
|
Код:
stock AddBan(ip[]) { if(CheckBan(ip) == 0) { new File: file = fopen("ban.cfg", io_append); new string[20]; format(string, sizeof(string), "\n%s", ip); fwrite(file, string); fclose(file); return 1; } return 0; }
Код:
stock RemoveBan(ip[]) { if(CheckBan(ip) == 1) { new string[20]; new File: file = fopen("ban.cfg", io_read); fcreate("tempBan.cfg"); new File: file2 = fopen("tempBan.cfg", io_append); while(fread(file, string)) { if(strcmp(ip, string, true, strlen(ip)) != 0 && strcmp("\n", string) != 0) { fwrite(file2, string); } } fclose(file); fclose(file2); file = fopen("ban.cfg", io_write); file2 = fopen("tempBan.cfg", io_read); while(fread(file2, string)) { fwrite(file, string); } fclose(file); fclose(file2); fremove("tempBan.cfg"); return 1; } return 0; }