Posts: 1,767
Threads: 124
Joined: Mar 2010
I need to create a ServerStats.ini when GameModeStarts and open it. Later read it and write stats into in.
Example write in it record players online. I don't how to do that because it's Y_Ini. If it would be dini or djson i would do that but not with it. I need help guys.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Posts: 1,767
Threads: 124
Joined: Mar 2010
Where to put this?:
Code:
INI:ServerStats[](name[], value[])
{
INI_Int("uptime", gUptime);
}
It'll create ServerStats.ini in Scriptfiles, yes? if yes, how to read something from there?
I just wanna read stats and show players. Like all kicked players, and showing in formatted message.
Posts: 1,767
Threads: 124
Joined: Mar 2010
What the fuck are you talking about? i need only help with create.ini when Serwer starts and if it's created i need to load this file and reading from it stats.
Example read all total deaths. I know how to create total but don't know how to create ServerStats.ini and read from it and load.
Posts: 1,767
Threads: 124
Joined: Mar 2010
I readed it but you're speaking to hard for my english and i don't know all what you saying. If you could be easier for me and tell me what function to create, load, write, read?
To read i need only in command.
pawn Code:
CMD:stats(playerid, params[])
{
SendFormattedMessage(playerid, COLOR, "* Total server kills: %d.", SerwerInfo[sTotalKills]);
return true;
}
Here you are ^ - reading from ServerStats.ini - i need only this.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Tell me where to put this:
pawn Code:
INI:ServerStats[](name[], value[])
{
INI_Int("uptime", gUptime);
}
And so.. if i wan't to show player total kills on server i need to this:
Code:
enum sInfo
{
sTotalKills
};
new ServerInfo[sInfo]
pawn Code:
public OnGameModeExit()
{
INI:ServerStats[](name[], value[])
{
INI_Int("TotalKills", SerwerInfo[sTotalKills]);
}
return true;
}
pawn Code:
main()
{
INI_Load("ServerStats.ini");
}
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
ServerInfo[sTotalKills]++;
/* Here i need to write into ServerStats.ini */
return true;
}
pawn Code:
CMD:stats(playerid, params[])
{
SendFormattedMessage(playerid, COLOR, "* Total server kills: %d.", SerwerInfo[sTotalKills]);
return true;
}
So.. more i don't know how to do.
Posts: 1,767
Threads: 124
Joined: Mar 2010
What? i don't understand you.
Posts: 1,767
Threads: 124
Joined: Mar 2010
pawn Code:
new INI:SerwerStats;
SerwerStats = INI_Open("Polski eXtra Serwer/Statystyki/SerwerStats.ini");
INI_Close(SerwerStats);
It's creating, yes? i mean.. it's created already. To put something in SerwerStats.ini i need every time to open it?
just like.. OnPlayerDeath
pawn Code:
new INI:SerwerStats;
SerwerStats = INI_Open("Polski eXtra Serwer/Statystyki/SerwerStats.ini");
INI_WriteInt(SerwerStats, "TotalDeaths", SerwerInfo[sTotalDeaths]+1);
INI_Close(SerwerStats);
Yes? or there's better way?
To read i'll need only use SerwerInfo[sTotalDeaths] - in message/textdraw whatever i wan't, yes?