[Release] FiveM Player Logger

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.

Repository Link

Release

Enjoy. I plan on expanding this script in the future to add kick/ban logs and whatever other events I can capture.

You must have mysql-async functioning for this to work, of course.

5 Likes

Ohh nice cant wait to test this


I have a question tho what types of licenses is it logging?

and is it logging all possible licenses so say it finders steam and normal fivem license it is logging both in the same table in the database?


Edit:

NWM found it out

1 Like

Looking at and understanding the code basics tells you exactly what itā€™s loggingā€¦

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.

Okay!

Yeah okay thanks for the info i was just wondering

I love it, much love <3

Nice release,

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?

Ewwwww. Nathen C. :heart:

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.

Suggestion:

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.

1.0.1 released. This fixes the bug where a new entry is logged whenever the player respawns rather than first connect. :sweat_smile:

Would it be possible to make this output to a discord chanel through webhooks?

Sure, with the tutorial above, but that is outside the scope of this release.

1 Like

Awesome script, thanks for sharing!

I have released 1.0.2 which resolves some issues with leave logging.

je doit metre quoi ici server_name = GetConvar(ā€œserver_numā€, ā€œUNKā€) ā€“ should be a CONVAR in server.cfg

did you add the kick and ban :stuck_out_tongue:

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