psychonic
08-12-2009, 09:27
This is an include I wrote for use with my SuperLogs (http://www.sourcemod.net/plugins.php?cat=0&mod=0&title=superlogs) plugin set. It has stocks for many HL Standard (http://developer.valvesoftware.com/wiki/HL_Log_Standard) log line formats, and also gets around the current limitations of Sourcemod's %L format operator and FormatUserLogText() function (not including team name on log line). This makes it very easy to add HLstatsX(:CE) (http://www.hlxcommunity.com) or Psychostats (http://www.psychostats.com) support to a plugin.
All included functions are stocks so they are only compiled in with the plugin if uses, or feel free to copy individual functions so as to not create a dependency on the include.
Note: you must call the GetTeams() function during OnMapStart() to correctly cache team names.
// Caches team names. Run during OnMapStart()
stock GetTeams(bool:insmod = false)
// Player Event (Ex. "player<userid><steamid><team>" triggered "something" (position "55 -23 0") (property1 "value1")
stock LogPlayerEvent(client, const String:verb[], const String:event[], bool:display_location = false, const String:properties[] = "")
// Player-Player Event (similar to player event, ex. "player" triggered "something" against "player2")
stock LogPlyrPlyrEvent(client, victim, const String:verb[], const String:event[], bool:display_location = false, const String:properties[] = "")
// Kill (logs a kills in regular format, ex. "player1" killed "player2" with "weapon")
stock LogKill(attacker, victim, const String:weapon[], bool:display_location = false, const String:properties[] = "")
// Suicide (logs a suicide in regular format, ex. "player" commited suicide with "weapon")
stock LogSuicide(victim, const String:weapon[], bool:display_location = false, const String:properties[] = "")
// Team Event (Ex. Team "teamname" triggered "something")
stock LogTeamEvent(team, const String:verb[], const String:event[], const String:properties[] = "")
// Team change (Ex. "player" joined team "teamname")
stock LogTeamChange(client, newteam, const String:properties[] = "")
// Role/Class change (Ex. "player" changed role to "class1")
stock LogRoleChange(client, const String:role[], const String:properties[] = "")
// Psychostats "KTRAJ" location log line
stock LogPSKillTraj(attacker, victim, const String:weapon[])
stock LogKillLoc(attacker, victim)
stock LogMapLoad()
stock IsValidPlayer(client)Updated 2015-12-21
- Replaced instances of deprecated GetClientAuthString
- Converted to use SourcePawn 1.7 Transitional Syntax
- Changed IsValidPlayer function to be static to avoid conflict when included in a plugin with function of same name.
Updated 2009-11-09
- Fixed formatting of position logging for plyrplyr events
- Added version define (starting with "#define LOGHELPER_VERSION 2")
Updated 2010-2-13
- Added Psychostats KTRAJ logging
All included functions are stocks so they are only compiled in with the plugin if uses, or feel free to copy individual functions so as to not create a dependency on the include.
Note: you must call the GetTeams() function during OnMapStart() to correctly cache team names.
// Caches team names. Run during OnMapStart()
stock GetTeams(bool:insmod = false)
// Player Event (Ex. "player<userid><steamid><team>" triggered "something" (position "55 -23 0") (property1 "value1")
stock LogPlayerEvent(client, const String:verb[], const String:event[], bool:display_location = false, const String:properties[] = "")
// Player-Player Event (similar to player event, ex. "player" triggered "something" against "player2")
stock LogPlyrPlyrEvent(client, victim, const String:verb[], const String:event[], bool:display_location = false, const String:properties[] = "")
// Kill (logs a kills in regular format, ex. "player1" killed "player2" with "weapon")
stock LogKill(attacker, victim, const String:weapon[], bool:display_location = false, const String:properties[] = "")
// Suicide (logs a suicide in regular format, ex. "player" commited suicide with "weapon")
stock LogSuicide(victim, const String:weapon[], bool:display_location = false, const String:properties[] = "")
// Team Event (Ex. Team "teamname" triggered "something")
stock LogTeamEvent(team, const String:verb[], const String:event[], const String:properties[] = "")
// Team change (Ex. "player" joined team "teamname")
stock LogTeamChange(client, newteam, const String:properties[] = "")
// Role/Class change (Ex. "player" changed role to "class1")
stock LogRoleChange(client, const String:role[], const String:properties[] = "")
// Psychostats "KTRAJ" location log line
stock LogPSKillTraj(attacker, victim, const String:weapon[])
stock LogKillLoc(attacker, victim)
stock LogMapLoad()
stock IsValidPlayer(client)Updated 2015-12-21
- Replaced instances of deprecated GetClientAuthString
- Converted to use SourcePawn 1.7 Transitional Syntax
- Changed IsValidPlayer function to be static to avoid conflict when included in a plugin with function of same name.
Updated 2009-11-09
- Fixed formatting of position logging for plyrplyr events
- Added version define (starting with "#define LOGHELPER_VERSION 2")
Updated 2010-2-13
- Added Psychostats KTRAJ logging