SOL
SAĞ
[C++] Statistics server for players + fake edition
SİDEBAR REKLAMI
//@svn/Server/common/service.h#define ENABLE_ONLINE_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
#ifdef ENABLE_OFFLINE_SHOP
    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 = 14:00    21 = 21:00    22 = 22:00    23 = 23:00        
*/
    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<=24-1; i++) {
        if (mResultHour == arrayDesc[i][0])
        {
            for (int j=1; j<=3; j++)
                mEmpire[i] += arrayDesc[i][1] / 3;
            mTotalOnline += arrayDesc[i][1];
            break;
        }
    }


    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:
 

YAZAR HAKKINDA;
arcface
Admin

Web Developer

KONU YORUMLARI
YORUM YAP
Image

C++ / C# / Python

[C++] Statistics server for players + fake edition

[C++] Statistics server for players + fake edition [C++] Statistics server for players + fake edition [C++] Statistics server for players + fake edition [C++] Statistics server for players + fake edition

EN ÇOK OKUNAN 5 MAKALELER
arcface
Admin Yazdı;

2 ay önce

Yarı insan denilince ne anlıyoruz önce ona bir bakalım. Yarı insan; bi..

arcface
Admin Yazdı;

2 ay önce

Rubinum2 Web Panel Rubinum2 Web Panel Rubinum2 Web PanelRubinum2 Web..

arcface
Admin Yazdı;

2 ay önce

Afro2 Web Panel Kodlaması Afro2 Web Panel Kodlaması Afro2 Web Pane..

arcface
Admin Yazdı;

2 ay önce

Aegea2 Site Teması İndir Aegea2 Site Teması İndir Aegea2 Site Teması..

arcface
Admin Yazdı;

2 ay önce

Discord Widget Discord Widget Discord Widget Discord Widget Di..