SA-MP Forums Archive
Logs question... - 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: Logs question... (/showthread.php?tid=486478)



Logs question... - Face9000 - 08.01.2014

A simple question about logs (joins, parts, deaths and so on).

Is better to log them on MySQL or in a file?

Because i log everything in a file so im considering it to move in MySQL. How i can read a single log then?

Example: I have a join log, which logs PlayerName, IP and Date/time when joined, how i can read from a command ingame this log for the chosen player? Like /joinlog Face900, which will show all logs related to my name.


Re: Logs question... - Patrick - 08.01.2014

Alright, I will reply your question before I sleep, to load files like .txt, etc... you need to use fopen - to open the file, fwrite - to something write in a file, fclose - to close a file,fread - to read a file,fexist - to check if the file exist or not and fremove - to delete a file.

Useful Link:

https://sampwiki.blast.hk/wiki/Fwrite
https://sampwiki.blast.hk/wiki/Fopen
https://sampwiki.blast.hk/wiki/Fclose
https://sampwiki.blast.hk/wiki/Fremove
https://sampwiki.blast.hk/wiki/Fread


Re: Logs question... - Face9000 - 08.01.2014

Emh, i already open the files with fopen and so on. I just need to know how to read a specific log if i store it in a mysql table.


Re: Logs question... - Seif- - 08.01.2014

Storing logs in MySQL is not very useful. Just store it in a file.


Re: Logs question... - DobbysGamertag - 08.01.2014

Quote:
Originally Posted by Seif-
Посмотреть сообщение
Storing logs in MySQL is not very useful. Just store it in a file.
Why not? i do it. It just depends what you need the "logs" for. Its useful if you want to display the logs in game, as well as on your website. If its in game, a simple file system will do.


Re: Logs question... - Hansrutger - 09.01.2014

Who says you can't upload info from files into a database? :P I don't know how but I will find out how! :P


Re: Logs question... - Scones - 09.01.2014

Quote:
Originally Posted by Seif-
Посмотреть сообщение
Storing logs in MySQL is not very useful. Just store it in a file.
Why not? Storing logs in MySQL makes it easier to for example put the logs on a web based ACP.

(Note: Can still be done with regular text files, but in my opinion it is easier to use a combination of PHP and MySQL)


Re: Logs question... - Face9000 - 09.01.2014

Still nobody has answered my queston, lol

Quote:

Example: I have a join log, which logs PlayerName, IP and Date/time when joined, how i can read from a command ingame this log for the chosen player? Like /joinlog Face900, which will show all logs related to my name.

^ In case i store in MySQL.


Re: Logs question... - KingHual - 09.01.2014

Quote:
Originally Posted by Face9000
Посмотреть сообщение
Still nobody has answered my queston, lol



^ In case i store in MySQL.
It depends on your table structure.

You should store it in a file only if you don't need to actually read the log file.