14.03.2016, 22:12
This is my code:
It all works great while the server is online. I even went to check if SavePhones(); works correctly by adding it in the middle of the script and the .cfg file looked just as I want.
But the main problem and the only problem is that all the data after the filterscript/server gets reset is set to 0. And all I get in the .cfg after the reloading of the filterscript is "0" and more "0".
The data somehow gets dumped after the filterscript is reloaded, like it just disapears.
Код:
enum PhoneInf { nNumber }; new PhoneInfo[200][PhoneInf]; public OnFilterScriptExit() { SavePhones(); return 1; } stock SavePhones() { new idx = 1, File:file; new string[256]; while(idx < 200) { format(string, sizeof(string), "%d\r\n",PhoneInfo[idx][nNumber]); if(idx == 1) { file = fopen("phones.cfg", io_write); } else { file = fopen("phones.cfg", io_append); } fwrite(file, string); fclose(file); idx++; } }
But the main problem and the only problem is that all the data after the filterscript/server gets reset is set to 0. And all I get in the .cfg after the reloading of the filterscript is "0" and more "0".
The data somehow gets dumped after the filterscript is reloaded, like it just disapears.