12.02.2014, 21:45
Ok so I think it's saving right... but wont really know till the loading part works right, so I'm not sure what is wrong, if its not saving or if it not loading. please take a look at my code and help me please. if you don't understand what im asking, ask me please i really need this fixed before my server opens in the next few days!
pawn Код:
stock LoadServerStats()
{
#define SERVER_STATS "serverstats.cfg"
if(!fexist(SERVER_STATS)) return 1;
new File:i_FileHandle = fopen(SERVER_STATS, io_read), sz_FileStr[256];
fread(i_FileHandle, sz_FileStr);
//sscanf(sz_FileStr, "iiiiiiiiiiii", TotalLogin, TotalConnect, TotalAutoBan, TotalRegister, MaxPlayersConnected, MPDay, MPMonth, MPYear, MPHour, MPMinute, TotalUptime);
//sz_FileStr = TotalLogin;
return fclose(i_FileHandle);
}
stock SaveServerStats()
{
#define SERVER_STATS "serverstats.cfg"
new sz_FileStr[256];
new File:i_FileHandle = fopen(SERVER_STATS, io_write);
//format(sz_FileStr, sizeof(sz_FileStr), "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", TotalLogin, TotalConnect, TotalAutoBan, TotalRegister,MaxPlayersConnected,MPDay,MPMonth,MPYear,MPHour,MPMinute,TotalUptime);
format(sz_FileStr, 256, "%d", TotalLogin);
fwrite(i_FileHandle, sz_FileStr);
return fclose(i_FileHandle);
}