Ok, i tried to re-write the code. Now i got this:
Anywhere in the script:
pawn Code:
INI:ServerStats[](name[], value[])
{
INI_String("MOTD", ServerInfo[sMOTD], 128);
INI_Int("TotalKills", ServerInfo[TotalKills]);
INI_Int("TotalDeaths", ServerInfo[TotalDeaths]);
INI_Int("TotalAccounts", ServerInfo[TotalAccounts]);
INI_Int("TotalJoins", ServerInfo[TotalJoins]);
INI_Int("TotalMGDMKills", ServerInfo[TotalMGDMKills]);
INI_Int("TotalSDMKills", ServerInfo[TotalSDMKills]);
return 1;
}
OnGameModeInit:
pawn Code:
INI_Load("ServerStats.ini");
OnGameModeExit:
pawn Code:
new INI:f = INI_Open("ServerStats.ini");
INI_WriteString(f, "MOTD", ServerInfo[sMOTD]);
INI_WriteInt(f, "TotalKills", ServerInfo[TotalKills]);
INI_WriteInt(f, "TotalDeaths", ServerInfo[TotalDeaths]);
INI_WriteInt(f, "TotalAccounts", ServerInfo[TotalAccounts]);
INI_WriteInt(f, "TotalJoins", ServerInfo[TotalJoins]);
INI_WriteInt(f, "TotalMGDMKills", ServerInfo[TotalMGDMKills]);
INI_WriteInt(f, "TotalSDMKills", ServerInfo[TotalSDMKills]);
INI_Close(f);
The rest of the code (enum) is the same, but still nothing.
I don't understand why do i have to open the file everytime i need to save something, i've the enum for a reason. I can use ServerInfo[TotalJoins] ++; to increase it in the live variable, then when the server will close/restart, the saving part will do the rest.
Also because if i read this variables ingame, they're correct.