Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------- Description -----------------------------------------//
- /* This mod is designed to log in-game messages and actions into separate log files, */
- /* providing a detailed breakdown of specific events such as "TextMsg", "SendAudio", */
- /* "StatusIcon", "HudTextArgs", and "DeathMsg". Each message is recorded in its own */
- /* log file to ensure easy tracking and reviewing of different types of game events. */
- /* */
- /* Key Features: */
- /* - Automatically creates and organizes log files into a dedicated folder. */
- /* - Captures specific in-game messages and actions like death messages and text prompts. */
- /* - Prevents duplicate logging by checking if a message has already been logged. */
- /* */
- /* This script ensures that relevant game events are tracked efficiently for future analysis. */
- /* It is a practical tool for admins and developers looking to monitor or analyze game logs. */
- //-------------------- Includes --------------------//
- #include < amxmodx >
- //-------------------- Functions --------------------//
- new TextMsgLog[ 128 ], SendAudioLog[ 128 ], StatusIconLog[ 128 ], HudTextArgsLog[ 128 ], DeathMsgLog[ 128 ]
- //-------------------- Plugin init --------------------//
- public plugin_init()
- {
- register_plugin( "Logger list", "v1.0", "RanAway`" )
- //-------------------- Logs folder --------------------//
- new logfile[ 128 ]
- get_localinfo( "amxx_logs", logfile, charsmax( logfile ) )
- formatex( logfile, charsmax( logfile ), "%s/loglist", logfile )
- //-------------------- Logs folder maker --------------------//
- if( !dir_exists( logfile ) ) mkdir( logfile )
- //-------------------- Logs --------------------//
- formatex( TextMsgLog, charsmax( TextMsgLog ), "%s/TextMsg.log", logfile )
- formatex( DeathMsgLog, charsmax( DeathMsgLog ), "%s/DeathMsg.log", logfile )
- formatex( SendAudioLog, charsmax( SendAudioLog ), "%s/SendAudio.log", logfile )
- formatex( StatusIconLog, charsmax( StatusIconLog ), "%s/StatusIcon.log", logfile )
- formatex( HudTextArgsLog, charsmax( HudTextArgsLog ), "%s/HudTextArgs.log", logfile )
- //-------------------- Messages --------------------//
- register_message( get_user_msgid( "TextMsg" ), "LogToFile" )
- register_message( get_user_msgid( "DeathMsg" ), "LogToFile" )
- register_message( get_user_msgid( "SendAudio" ), "LogToFile" )
- register_message( get_user_msgid( "StatusIcon" ), "LogToFile" )
- register_message( get_user_msgid( "HudTextArgs" ), "LogToFile" )
- }
- //-------------------- Logs --------------------//
- public LogToFile( msgid )
- {
- new logmsg[ 64 ], Line[ 255 ], checkmsg[ 255 ], File
- //-------------------- TextMsg --------------------//
- if( msgid == 77 ) File = fopen( TextMsgLog, "a+" ), get_msg_arg_string( 2, logmsg, charsmax( logmsg ) )
- //-------------------- DeathMsg --------------------//
- if( msgid == 83 ) File = fopen( DeathMsgLog, "a+" ), get_msg_arg_string( 4, logmsg, charsmax( logmsg ) )
- //-------------------- SendAudio --------------------//
- if( msgid == 100 ) File = fopen( SendAudioLog, "a+" ), get_msg_arg_string( 2, logmsg, charsmax( logmsg ) )
- //-------------------- StatusIcon --------------------//
- if( msgid == 107 ) File = fopen( StatusIconLog, "a+" ), get_msg_arg_string( 2, logmsg, charsmax( logmsg ) )
- //-------------------- HudTextArgs --------------------//
- if( msgid == 145 ) File = fopen( HudTextArgsLog, "a+" ), get_msg_arg_string( 1, logmsg, charsmax( logmsg ) )
- //-------------------- Check if already print --------------------//
- while( !feof( File ) )
- {
- fgets( File, Line, charsmax( Line ) )
- trim( Line )
- parse( Line, checkmsg, charsmax( checkmsg ) )
- if( equali( Line, logmsg ) )
- {
- fclose( File )
- return
- }
- }
- //-------------------- print --------------------//
- fprintf( File, "%s^n", logmsg )
- fclose( File )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement