VegaS 1087 Posted November 2, 2016 Share Posted November 2, 2016 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Here is a small playground for owners of servers . xD I made a small improvements statics for players via command. //@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(¤tTime); localTime = localtime(¤tTime); #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: This is the hidden content, please Sign In or Sign Up Have fun ^^ (not tested full, sorry for shit code, It was quickly made fun) Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal 11 1 2 11 Link to comment Share on other sites More sharing options...
thespeedy 20 Posted November 3, 2016 Share Posted November 3, 2016 how to remove fake edtion? Link to comment Share on other sites More sharing options...
Kenny1337 8 Posted November 3, 2016 Share Posted November 3, 2016 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 }, 1 Link to comment Share on other sites More sharing options...
thespeedy 20 Posted November 3, 2016 Share Posted November 3, 2016 .... gets better? Link to comment Share on other sites More sharing options...
VegaS 1087 Posted November 3, 2016 Author Share Posted November 3, 2016 On 03.11.2016 at 0:25 PM, thespeedy said: .... gets better? Check first post with code, i edited. 1 Link to comment Share on other sites More sharing options...
ZeNu 301 Posted November 3, 2016 Share Posted November 3, 2016 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 ). Fine , Good Job . Thanks . - Sorry for my shit english - 1 Link to comment Share on other sites More sharing options...
Premium Crystal™ 25 Posted November 3, 2016 Premium Share Posted November 3, 2016 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 1 Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted November 7, 2016 Active Member Share Posted November 7, 2016 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! Link to comment Share on other sites More sharing options...
VegaS 1087 Posted November 11, 2016 Author Share Posted November 11, 2016 (edited) 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: Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
felipeard1 167 Posted November 12, 2016 Share Posted November 12, 2016 Good Work Link to comment Share on other sites More sharing options...
Kronzu 11 Posted November 13, 2016 Share Posted November 13, 2016 My mistake had 2 the same functions. Link to comment Share on other sites More sharing options...
Recommended Posts