This simple script logs player identifiers to a MySQL table when they connect to server and logs when they leave. Very useful for stats generation and capturing licenses if you need to ban users who leave too quickly.
What hallux said. Those that feel like it can add columns to the table for other identifiers if they care, but I only log the ones that are really relevant.
However, this will fill up databases like crazy as it duplicates entires. I joined once, restarted, joined again and thereās now two entires of me joining. Is this a bug? Did I install it wrong?
This is intentional. It will log every instance of someone connecting (successfully, spawning into the server). This is so you can log players over time.
If absolutely required you can āclean upā every so often by removing old entries with a simple query.
That said, you can have tens of thousands of records in the table and it should not affect performance much provided the mysql server isnāt running on a hamster wheel.
Use the playerconnecting event. This would make it more āsecureā and also playerspawnned will execute everytime a player respawnsā¦ Using playerconnecting would also make the whole script server-sideā¦
I should probably add a variable so it only fires onceā¦
I donāt use playerConnecting because that fires every time an attempt is made. If the serverās full, the user gets rejected by hardcap but that event is still fired. Some people like spam connecting for whatever reason.
is there a way to make this script log when someone starts and ends there shift im trying to get webhood to log how many hours my workers worked at the end of the week so i can pay them