08.10.2011, 12:56
Well, I am using a function that will create a file with player's IP and information about him being banned or not, once he get /ban or /unban'd.
After I use /ban, the function will successfully create the file as well as write the information inside, but right after the server crashes. This is the code:
So, the server crashed but the file %s.ini (actually -IP NUMBER-.ini) and "Banned." inside is written.
Then, when I start the server again, the file is still there, so the function in OnPlayerConnect checks if the player is banned.
This crash the server again.
Anybody knows what is the problem?
After I use /ban, the function will successfully create the file as well as write the information inside, but right after the server crashes. This is the code:
Код:
format(string, sizeof(string), "Bans/%s.ini", tmp2); new File:BanF=fopen(string, io_write); fwrite(BanF, "Banned."); fclose(BanF);
Then, when I start the server again, the file is still there, so the function in OnPlayerConnect checks if the player is banned.
Код:
new tmp2[100]; GetPlayerIp(playerid,tmp2,100); format(string, sizeof(string), "Bans/%s.ini", tmp2); if(fexist(string)) { new File:BanF = fopen(string, io_read); fread(BanF, string); fclose(BanF); } if(strcmp(string, "Banned.", true) == 0) { Kick(playerid); }
Anybody knows what is the problem?