Jump to content

Statistics Server for Players + Fake Edition


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Here is a small playground for owners of servers . xD

I made a small improvements statics for players via command.

1b6566bf9a264c0fadcbb06d54f7f44f.png

 

//@svn/Server/common/service.h
#define ENABLE_ONLINE_COMMAND
#define ENABLE_COUNTER_FAKE //@ DISABLE IF YOU NOT WANT TO HAVE FAKE PLAYER ON COMMAND
//@svn/Server/game/src/cmd.cpp
//1.) Search:
	{ "messenger_auth",	do_messenger_auth,	0,			POS_DEAD,	GM_PLAYER	},
//2.)  Add bellow:
#ifdef ENABLE_ONLINE_COMMAND
	{ "online",	do_online,	0,			POS_DEAD,	GM_PLAYER	},
#endif
//1.) Search:
ACMD(do_messenger_auth);
//2.) Add bellow:
#ifdef ENABLE_ONLINE_COMMAND
	ACMD(do_online);
#endif
  
//@svn/Server/game/src/cmd_general.cpp
//1.) Add where you want:
ACMD(do_online)
{
/*********************************************************************
* date        : 2016.10.25
* file        : cmd_general.cpp
* author      : VegaS
* description : Statistics server + configuration for fake
*/
	time_t currentTime;
	struct tm *localTime;
	
	time(&currentTime);
	localTime = localtime(&currentTime);
#define ENABLE_OFFLINE_SHOP_SYSTEM //@disable if you not have offlineShop
#ifdef ENABLE_OFFLINE_SHOP_SYSTEM
	std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM player.offline_shop_npc WHERE owner_id and channel = %d", g_bChannel));
	MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
	
	int	mShopsOffline = 0;
	str_to_number(mShopsOffline, row[0]);
#endif
	int mResultHour = localTime->tm_hour, mResultMin = localTime->tm_min, mResultSec = localTime->tm_sec;	
	int mTotalOnline;
	int * mEmpire;
	int mLocal;

	DESC_MANAGER::instance().GetUserCount(mTotalOnline, &mEmpire, mLocal);
/*
	0 = 00:00	1 = 01:00	2 = 02:00	3 = 03:00	4 = 04:00	5 = 05:00
	6 = 06:00	7 = 07:00	8 = 08:00	9 = 09:00	10 = 10:00	11 = 11:00
	12 = 12:00	13 = 13:00	14 = 14:00	15 = 15:00	16 = 16:00	17 = 17:00	
	18 = 18:00	19 = 19:00	20 = 20:00	21 = 21:00	22 = 22:00	23 = 23:00		
*/
#ifdef ENABLE_COUNTER_FAKE
    static int arrayDesc[23 + 1][2] =
     {	/* 
          First row -> Current hour | Second row -> Value added for players fake 
          Example: From 15:00 until 15:59:59 will be added on statics + 75 players online fake. Because -> { 15, 75 }
		*/
        { 0, 190  },     { 1, 175  },    { 2, 160  },	{ 3, 140  },     { 4, 130  },    { 5, 100  },
        { 6, 80   },     { 7, 75   },    { 8, 60   },	{ 9, 55   },     { 10, 40  },    { 11, 30  },
        { 12, 50  },     { 13, 60  },    { 14, 70  },	{ 15, 75  },     { 16, 80  },    { 17, 90  },
        { 18, 105 },     { 19, 120 },    { 20, 135 },	{ 21, 155 },     { 22, 175 },    { 23, 180 }
     };
	
    for (int i=0; i<_countof(arrayDesc); i++) {
        if (mResultHour == arrayDesc[i][0])
        {
            for (int j=1; j<=3; j++)
                mEmpire[i] += arrayDesc[i][1] / 3;
            mTotalOnline += arrayDesc[i][1];
            break;
        }
    }
#endif
	if (ch->IsGM())
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current time on server: %d:%d:%d", mResultHour, mResultMin, mResultSec);
	}

	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current channel: [%d]", g_bChannel);	
	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current players online on this channel (all empire): [%d]", mTotalOnline);
	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current players online on empire: Shinshoo - [%d] | Chunjo - [%d] | Jinno - [%d]", mEmpire[1], mEmpire[2], mEmpire[3]);
#ifdef ENABLE_OFFLINE_SHOP
	ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current shops offline on this channel: [%d]", mShopsOffline);
#endif
}

 

Download:

Have fun ^^ (not tested full, sorry for shit code, It was quickly made fun)

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 16
  • kekw 1
  • Good 2
  • Love 18
Link to comment
https://metin2.dev/topic/13885-statistics-server-for-players-fake-edition/
Share on other sites

54 minutes ago, thespeedy said:

how to remove fake edtion?

         First row -> Current hour | Second row -> Value added for players fake 
          Example: From 15:00 until 15:59:59 will be added on statics + 75 players online fake. Because -> { 15, 75 }
		*/
        { 0, 190  },     { 1, 175  },    { 2, 160  },	{ 3, 140  },     { 4, 130  },    { 5, 100  },
        { 6, 80   },     { 7, 75   },    { 8, 60   },	{ 9, 55   },     { 10, 40  },    { 11, 30  },
        { 12, 50  },     { 13, 60  },    { 14, 70  },	{ 15, 75  },     { 16, 80  },    { 17, 90  },
        { 18, 105 },     { 19, 120 },    { 20, 135 },	{ 21, 155 },     { 22, 175 },    { 23, 180 }

 

 

Edit like

 

{ 0, 0 }, { 1, 0 }, { 2, 0 },  

  • Love 1
  1. Yeah . very nice this topic and very good this option for PServers (No include part "fake function") xD because function for players online or other shit FROM website is very shit (Yeah , this part is really straight and ugly ).
  2. Fine , Good Job .
  3. Thanks .

 

- Sorry for my shit english -

  • Love 1
  • Premium
11 hours ago, Kenny1337 said:

         First row -> Current hour | Second row -> Value added for players fake 
          Example: From 15:00 until 15:59:59 will be added on statics + 75 players online fake. Because -> { 15, 75 }
		*/
        { 0, 190  },     { 1, 175  },    { 2, 160  },	{ 3, 140  },     { 4, 130  },    { 5, 100  },
        { 6, 80   },     { 7, 75   },    { 8, 60   },	{ 9, 55   },     { 10, 40  },    { 11, 30  },
        { 12, 50  },     { 13, 60  },    { 14, 70  },	{ 15, 75  },     { 16, 80  },    { 17, 90  },
        { 18, 105 },     { 19, 120 },    { 20, 135 },	{ 21, 155 },     { 22, 175 },    { 23, 180 }

 

 

Edit like

 

{ 0, 0 }, { 1, 0 }, { 2, 0 },  

#define ENABLE_COUNTER_FAKE

comment this

  • Love 1
  • Active+ Member

It showing format of server time badly. When is 13:04:02 it showing 13:4:2. Can somebody tell me how to solve it?

Thanks for answers!

Regards ReFresh

I'll be always helpful!  😉

On 07.11.2016 at 3:31 PM, ReFresh said:

It showing format of server time badly. When is 13:04:02 it showing 13:4:2. Can somebody tell me how to solve it?

Search:

ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current time on server: %d:%d:%d", mResultHour, mResultMin, mResultSec);

Delete and replace with:

ch->ChatPacket(CHAT_TYPE_INFO, "[i] Current local time and date on server: %s", asctime(localTime));

Result:

8e983898c89c43f5882807ea53565283.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.