Raised This Month: $ Target: $400
 0% 

[INC] loghelper (updated 2010-05-27)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
psychonic

BAFFLED
Join Date: May 2008
Old 08-12-2009 , 09:27   [INC] loghelper (updated 2010-05-27)
Reply With Quote #1

This is an include I wrote for use with my SuperLogs plugin set. It has stocks for many HL 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) or Psychostats 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.

PHP Code:
// 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(clientvictim, 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(attackervictim, 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(clientnewteam, 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(attackervictim, const String:weapon[])

stock LogKillLoc(attackervictim)
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
Attached Files
File Type: inc loghelper.inc (9.3 KB, 2299 views)

Last edited by psychonic; 12-21-2015 at 11:27.
psychonic is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode