HL Log Standard logging script - compability with stat tracking services like gameME!

The back story

My community used HLstatsX to track player statistics on our TF2 and CSS servers. However hosting the database ourselves was a bit of a nuisance and was causing performance issues, so we dumped it. Instead, we signed up for the gameME service, which is basically an evolved version of HLstatsX managed by its original developers. 5 euros per month for the first server, and only 1 euro for every additional server after that.

After messing a bit with the dashboard an customization options I noticed that all this stats tracking would be ideal for developers of Garry’s Mod gamemodes. Usually we have to create our own data-management systems to do proper stats tracking. I contacted gameME’s support and now they’re offering stats tracking for GMod too!

Here are a few examples of what’s being tracked on our Zombie Survival gamemode server:

General activity / player locations / daily awards
Player kill / death / activity overviews
Detailed player overviews
Performed actions (I still have a lot of possible actions to add)
Map playtime and activity
Team and class overview

The system

gameME tracks servers by reading the logs through rcon. It can use AMX / SourceMod plugins for some additional ingame messages but those are not required.

There is a problem with Garry’s Mod though. It barely pushes anything to the server log! The only events it does log are

Things like weapon kills show up in the server console, (“player” killed “player” using “weapon”) but these are useless since they do not use show up in the server log, nor to they adhere to the HL Log Standard.

This is why I created this script. To give developers the possibility to easily push (custom) events to the server log in the HL Log Standard format. These can then be used by parsers and services, like gameME, to build data models.

The HL Log Standard

Copy pasta:

Basically every multiplayer-oriented Source game (TF2 / CSS / DoDS / etc) makes use of this logging standard to log game events (just look at the console of an active TF2 server!). Stats tracking services, like gameME, can use these to build extensive overviews and even heat maps (although the options for GMod right now are limited since they only just added GMod support).

The script

– DOWNLOAD –

This script adds the following functions:
[lua] log.InitializeTeamBased( team 1 id, team 1 code, team 2 id, team 2 code, … )
log.PlayerKill( attacker, victim, weapon, properties )
log.PlayerInjured( attacker, victim, weapon, properties )
log.PlayerSuicide( player, weapon, properties )
log.PlayerJoinTeam( player, team, properties )
log.PlayerRoleChange( player, role, properties )
log.PlayerOnPlayerAction( player, target, action, properties )
log.PlayerAction( player, action, properties )
log.TeamAction( team, action, properties )
log.WorldAction( action, properties )
log.TeamAlliance( team1, team2, properties )
log.TeamScoreReport( team, score, numplayers, properties )
log.PlayerPrivateMessage( sender, receiver, message, properties )
log.PlayerScore( player, score, properties )
log.PlayerSelectWeapon( player, weapon, properties )
log.PlayerAcquireWeapon( player, weapon, properties )
log.Comment( message )[/lua]

These are pretty much all the possible formats the HL Log Standard provides for events. A service like gameME doesn’t use them all, but other parsers might.

Read the included readme.txt and script commentary for info on how to implement these functions in your own scripts.

Let me know if there are any problems or bugs! If you subscribed a GMod server to gameME and have trouble configuring things, I can help out too.

Cool I guess.

Also in the Lua file you’re requiring a module called log?

Yes, because I defined the script functions as a module (just like everything in the garrysmod/lua/includes/modules folder in the GMod source). It does not require a dll.

Awesome stuff Clavus.