cuceritorul28 3 Posted December 13, 2020 Share Posted December 13, 2020 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 More sharing options...
ondry 333 Posted December 13, 2020 Share Posted December 13, 2020 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 More sharing options...
Catalin2o14 141 Posted December 14, 2020 Share Posted December 14, 2020 hi. show me what appears when you type the command / who and post on pastebin the function: GetUserCount from desc_manager Link to comment Share on other sites More sharing options...
cuceritorul28 3 Posted December 14, 2020 Author Share Posted December 14, 2020 (edited) https://pastebin.com/XXX2w9Pw - GetUserCount from desc_manager https://metin2.download/picture/213RTKX7a96bHQkWGxxor5Be3kK17Qb7/.png Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now