09.02.2019, 13:17
Quote:
Wouh, I wasn't expecting such serious answer! Thanks for your response, and let me explain you why I do not like your table and column management. I wanted to do something like player chat displaying on my ucp panel or online chat tracking via website for admins FOR CERTAIN PLAYER. If player gets message (chat message, not pm, admin chat or any other message) - that message is stored in database. If he sends that message - it also goes to database. In this proper way I want create an opportunity for admins to see the whole certain player chat. Why am I doing it this way? I don't see any sense of storing just sender name/id and message what he send. If I will have 1000players in future, they all are playing over whole San Andreas map, and how should I detect to whom of left 999players this specified message is adressed? Totally nonsens. Thats how my database management system is made. First of all I have done two mysql connections using mysql_global_options(DUPLICATE_CONNECTIONS, true);. One will be my main database with users, houses, vehicles, etc, and second one is provided entirely for logging purposes. I have separate tables for chat logs, commands, server logs, sms logs, and connections (connects and disconnects). For now, I have only done server log part yet, cause I don't even have registration/login systems in my gamemode, its entirely blank IG, but for now I'm just preparing it for future easier work with it. Soo, I have 3 columns, as far as I remember (I'm writing this post from the phone, soo there is no way at this moment to check my database), ID (Auto increment, unique), Date (YYYY-MM-DD HH:MM:SS), and message itself. I have done Log function, with 3 parameters, 1 of them is optional. It looks like this: Log(type, text[], bool:error = false). Where type is, i put there one of my defines, for ex. LOG_TYPE_CHAT. In text I write comment for the log, actual log, if I can name it this way and error boolean is for kind of tag in text itself. If it's false - log output will start with this symbols [SUCCESS]. If error bool is true, the [SUCCESS] will change to [ERROR]. I'm planning to finish logs system in near future, and the hardest thing so far was generating the idea for proper chatlog saving, what would fit my requirements presented earlier. I decided to do it this way (If someone have better idea, you are free to share it), I have 6 columns. ID, SenderID, ReceiverID, Date, IP and Message. ID is auto increment and unique for every log. SenderID is the database unique ID of player, who sent this message. ReceiverID is player who got that message from Sender. I think there are no inneed of explaining other columns aswell
![]() |

Also, if you use parallel queries (mysql_pquery), you don't need a separate connection for the logger, it automatically opens as many connections as your connection pool size is anyway.
Good luck!