Y_Ini question
#9

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.
Reply


Messages In This Thread
Y_Ini question - by SymonClash - 27.03.2019, 09:52
Re: Y_Ini question - by polygxn - 27.03.2019, 10:29
Re: Y_Ini question - by SymonClash - 27.03.2019, 11:08
Re: Y_Ini question - by introzen - 27.03.2019, 11:50
Re: Y_Ini question - by SymonClash - 27.03.2019, 11:55
Re: Y_Ini question - by introzen - 27.03.2019, 12:06
Re: Y_Ini question - by SymonClash - 27.03.2019, 14:23
Re: Y_Ini question - by Hazon - 27.03.2019, 14:32
Re: Y_Ini question - by SymonClash - 27.03.2019, 14:49
Re: Y_Ini question - by SymonClash - 27.03.2019, 20:02
Re: Y_Ini question - by SymonClash - 28.03.2019, 09:12
Re: Y_Ini question - by SymonClash - 29.03.2019, 08:34
Re: Y_Ini question - by SymonClash - 29.03.2019, 14:14
Re: Y_Ini question - by SymonClash - 30.03.2019, 16:41

Forum Jump:


Users browsing this thread: 1 Guest(s)