Save players logs - 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)
+--- Thread: Save players logs (
/showthread.php?tid=628350)
Save players logs -
pollo97 - 09.02.2017
Hi everyone,
I'm trying to make a log system to track player.
Now the question: is better save this information on a table in the database or writing into a simple text file?
I have to share this data with the game and the website, which is better?
Thanks in advance.
Re: Save players logs -
AndreiWow - 09.02.2017
I write it in a file, don't see why I should save it in a mysql table.
PHP код:
function KickLog(string[])
{
new
entry[ 128 ],
year,
month,
day,
hour,
minute,
second
;
getdate(year, month, day);
gettime(hour, minute, second);
format(entry, sizeof(entry), "%s | (%d-%d-%d) (%d:%d:%d)\n",string, day, month, year, hour, minute, second);
new File:hFile;
hFile = fopen("Basic/logs/KickLog.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}
Use KickLog(string); under a format, example.
PHP код:
format(string, sizeof(string), "x has kicked y", ...);
SendClientMessage(playerid, -1, string);
KickLog(string);
Re: Save players logs -
oMa37 - 09.02.2017
If you want to show the logs in your website, You gotta save it with MySQL.
Even though if you don't want to show it in your website, I always prefer MySQL for saving stuff.
Re: Save players logs -
pollo97 - 09.02.2017
Quote:
Originally Posted by AndreiWow
I write it in a file, don't see why I should save it in a mysql table.
PHP код:
function KickLog(string[])
{
new
entry[ 128 ],
year,
month,
day,
hour,
minute,
second
;
getdate(year, month, day);
gettime(hour, minute, second);
format(entry, sizeof(entry), "%s | (%d-%d-%d) (%d:%d:%d)\n",string, day, month, year, hour, minute, second);
new File:hFile;
hFile = fopen("Basic/logs/KickLog.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}
Use KickLog(string); under a format, example.
PHP код:
format(string, sizeof(string), "x has kicked y", ...);
SendClientMessage(playerid, -1, string);
KickLog(string);
|
Even if I have to show on the website?
Quote:
Originally Posted by oMa37
If you want to show the logs in your website, You gotta save it with MySQL.
Even though if you don't want to show it in your website, I always prefer MySQL for saving stuff.
|
Saving into database every time that a player gives a weapon or pays someone.. doesn't create too much lag?
And this amount of data stored into the database isn't a problem?
Re: Save players logs -
oMa37 - 09.02.2017
Quote:
Originally Posted by pollo97
Saving into database every time that a player gives a weapon or pays someone.. doesn't create too much lag?
And this amount of data stored into the database isn't a problem?
|
No, Not at all.
I used to save every single thing that player do in my server and everything was normal, That's what MySQL used for.
Re: Save players logs -
AndreiWow - 09.02.2017
Well, you gotta use MySQL if you want to show them on a website, I don't want to show the logs on a website so I don't use MySQL.