Jump to content
×
×
  • Create New...
  • 0

Channel status is always Norm


cuceritorul28

Question

Hello, i have a little problem with channel status, the problem comes from desc_client.cpp where, the function void CLIENT_DESC::UpdateChannelStatus(DWORD t, bool fForce) is not working properly. The function defines 4 states for the server, OFFLINE, NORM, BUSY and FULL. I parsed the variables into a syslog from the function and i realised that the iTotal it's always 0, so the server works in only 2 states, OFFLINE and NORM. Can anybody help me to fix this problem? I want to implement the count of players of the servers into the login interface. Another test i've made is with the command /who ingame, command which count properly the numbler of players.

Here is the function:

void CLIENT_DESC::UpdateChannelStatus(DWORD t, bool fForce)
{
    enum {
        // CHANNELSTATUS_UPDATE_PERIOD = 5*60*1000,    // 5분마다
        CHANNELSTATUS_UPDATE_PERIOD = 1*1000,    // 5분마다
    };
    DWORD tLCSUP = m_tLastChannelStatusUpdateTime+CHANNELSTATUS_UPDATE_PERIOD;
    if (fForce || tLCSUP < t) {

        int iTotal;
        int * paiEmpireUserCount;
        int iLocal;
        DESC_MANAGER::instance().GetUserCount(iTotal, &paiEmpireUserCount, iLocal);
        TChannelStatus channelStatus;
        channelStatus.nPort = mother_port;
#if defined(__CHANNEL_STATUS_UPDATE__)
        channelStatus.player_count = iTotal;
#endif        

        if (g_bNoMoreClient) channelStatus.bStatus = 0;
        else channelStatus.bStatus = iTotal > g_iFullUserCount ? 3 : iTotal > g_iBusyUserCount ? 2 : 1;
        sys_log(0, "Total %d , FullUserCount %d , BusyUserCount %d", iTotal, g_iFullUserCount, g_iBusyUserCount);
        DBPacket(HEADER_GD_UPDATE_CHANNELSTATUS, 0, &channelStatus, sizeof(channelStatus));
        m_tLastChannelStatusUpdateTime = t;
    }
}

Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0

not the best solution, but you can try to get the number from query

		std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM player.player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play"));

		int count = 0;
		if ( pmsg->Get()->uiNumRows > 0 )
		{
			MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
			str_to_number(count, row[0]);
		}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 0

      Looking for Someone to create the queries etc for armors and weapons

    2. 13

      Official Private Shop Search

    3. 944

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    4. 79

      GUI Teleport System

    5. 0

      inventory slot marking system cant compile

    6. 8

      Inventory Bug

    7. 63

      Metin2 Dev - Changelogs

  • Recently Browsing

    • No registered users viewing this page.

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.