[Mod] Log Gm Commands in your database menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    Cursed's Avatar Contributor
    Reputation
    270
    Join Date
    Jun 2007
    Posts
    1,380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Mod] Log Gm Commands in your database

    iveen´s Gm commands log mod



    Today i looked through Emupedia and found a Mod that could be useful for some of you. All Credits for this go to iveen of Emupedia.
    What it does? You know that you can enable "LogGmcommands" in your ascent.conf. Those commands will be logged in a text file in your ascent folder. iveen did not like that and here is the mod:
    Every Command will be logged in the table "gmcommands" in your database.




    I got tired of the crappy format (no pun intended) of the gmcommands.log so I made this mod. What it does is instead of logging all actions to gmcommands.log is putting all the data in a specific table in the database.

    How to use:

    Replace the whole section
    Code:

    Code:
    void SessionLogWriter::writefromsession(WorldSession* session, const char* format, ...)
    {
    ...
    }
    in WorldSession.cpp, line 862 with this:
    Code:
    Code:
    void SessionLogWriter::writefromsession(WorldSession* session, const char* format, ...)
    {
    	if(!IsOpen())
    		return;
    
    	va_list ap;
    	va_start(ap, format);
    	char out2[32768];
    	char thetime[32768];
    
    	time_t t = UNIXTIME;
    	tm* aTm = localtime(&t);
    	snprintf(thetime, 32768, "%-4d-%02d-%02d %02d:%02d:%02d",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
    
    	vsnprintf(out2, 32768, format, ap);
    
    	QueryResult * result = CharacterDatabase.Query("INSERT INTO `gmcommands` (`ip`,`time`,`account`,`player`,`info`) VALUES ('%s','%s','%s','%s','%s')", 
    		session->GetSocket() ? session->GetSocket()->GetRemoteIP().c_str() : "NOIP", 
    		thetime,
    		session->GetAccountName().c_str(), 
    		session->GetPlayer() ? session->GetPlayer()->GetName() : "nologin",
    		out2);
    	fflush(m_file);
    	va_end(ap);
    }
    If you want to customize the way data is entered in the DB just modify the query above.

    And here's the structure of the gmcommands table (you must create it in your character database):
    Code:
    Code:
    -- ----------------------------
    -- Table structure for gmcommands
    -- ----------------------------
    CREATE TABLE `gmcommands` (
      `id` bigint(20) NOT NULL auto_increment,
      `time` timestamp NULL default NULL,
      `ip` varchar(255) default NULL,
      `account` varchar(255) default NULL,
      `player` varchar(255) default NULL,
      `info` varchar(255) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;

    //iveen


    EDIT: Forgot to say, if you have the "log cheaters" option enabled this will also pop-up in your database, so my suggestion is to disable it.


    Original Thread on Emupedia:
    Mod
    I hope you can use this and have a nice day

    [Mod] Log Gm Commands in your database
  2. #2
    King Shaun's Avatar Member
    Reputation
    419
    Join Date
    Dec 2007
    Posts
    1,305
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems nice to me!

    Thanks for sharing..

    Many kind regards,
    Shaun.


    Threads of the Week: [Errage] [Blizzard] [Rapidshare]

  3. #3
    Spartansp's Avatar Member
    Reputation
    644
    Join Date
    Sep 2007
    Posts
    1,803
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    really cool lol im going to try it some day :P

  4. #4
    Cursed's Avatar Contributor
    Reputation
    270
    Join Date
    Jun 2007
    Posts
    1,380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh and i forgot to say: I had the permission to post it :P

Similar Threads

  1. How To Solo Raid Instances in your Private Server without changing your databases!
    By eggplant140 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 08-19-2023, 02:06 PM
  2. [GUIDE] ...How To Excute SQL FILES In To Your Database...
    By Followup in forum WoW EMU Guides & Tutorials
    Replies: 10
    Last Post: 08-01-2020, 08:04 AM
  3. UPDATING your Database to be Compatible with the Latest Ascent Revisions
    By JulianX in forum WoW EMU Guides & Tutorials
    Replies: 53
    Last Post: 01-08-2008, 09:23 PM
  4. Neat places and objects to add to your database!
    By Quick$ilver in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 10-13-2007, 05:23 PM
  5. add a radio command to your server?
    By WoWLegend in forum World of Warcraft General
    Replies: 2
    Last Post: 10-29-2006, 04:43 AM
All times are GMT -5. The time now is 09:12 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search