Statistics problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Statistics problem (
/showthread.php?tid=271881)
Statistics problem -
Sreadon - 26.07.2011
Hello,
Today, I start to work on my server statistics, but I have a problem with this.. I don't know how to "refresh" it. I explain, I want to count the number of executions of the gamemode, so, sampserver.exe. So, I have creat this, In OnGameModeInit:
pawn Код:
new x;
format(file, sizeof(file), "/Server/TimeOnline.ini");
dini_IntSet(file, "Reboots", x);
x++;
X is the number of reboots, but, I don't know why, that don't refresh it, that always show "Reboots=0". Anyone can help me? Where I've make a mistake?
Thank's.
Re : Statistics problem -
Sreadon - 26.07.2011
Thank's, I see, so I've re-writte it:
pawn Код:
format(file, sizeof(file), "/Server/TimeOnline.ini");
if (!dini_Exists(file))
{
dini_IntSet(file, "Reboots", 0);
}
if(fexist(file))
{
[Reboots]++;
dini_Int(file, "Reboots");
}
But, with this, I have errors.. I don't know how to solve it.
Re : Statistics problem -
Sreadon - 26.07.2011
Ok thank's, I've replace the second "if" by "else if". Yeah, I know dini is old and slow, but I don'k know what else I can use.. I've read some MySQL tutorials but I don't like the system because that's need a database.
[EDIT]:
I've tryed a lot of things.. This one work but only one once, If "Reboot" is at 0, that make 1, but if I reboot again, It's always show 1..
pawn Код:
format(file, sizeof(file), "/Server/TimeOnline.ini");
if (!dini_Exists(file))
{
dini_IntSet(file, "Reboots", 0);
}
else if(fexist(file))
{
dini_Get(file, "Reboots");
ServerInfo[Reboots]++;
dini_IntSet(file,"Reboots",ServerInfo[Reboots]);
}
[EDIT 2]: Solved, replace dini_Get by dini_Int