1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

1.0.9.8 Players online

Discussion in 'General Support & Questions' started by ozon, Jan 30, 2018.

  1. ozon

    ozon New Member

    Hello, I hope that someone will be able to help me with 2 things

    1. Most important for me
    I would like to modify Online Ranking to use that query
    Code:
    SELECT e.Id, e.GameIDC, c.memb___id, c.ConnectStat 
    FROM AccountCharacter AS e LEFT OUTER JOIN MEMB_STAT AS c ON e.Id = c.memb___id
    WHERE (c.ConnectStat = '1')
    That query will show Nicknames of players who are online
    And to show on ranking page
    Avatar with character class and GameIDC

    If someone could do that I will be grateful for full file rank-online.php and online.php (I think that only this 2 files should be edited)



    2. Why on my Website all is working good but Online ranking,
    I've got "There are no ranking results to display." ?
     
  2. Lautaro

    Lautaro Administrator Developer

    Your query should look something like this (in the rankings class)

    PHP:
    $result $this->mu->query_fetch("SELECT e.Id, e.GameIDC, c.memb___id, c.ConnectStat FROM AccountCharacter AS e LEFT OUTER JOIN MEMB_STAT AS c ON e.Id = c.memb___id WHERE c.ConnectStat = ?", array(1));
     
  3. ozon

    ozon New Member

    Ok, Lautaro I think that there is mistake in one database IGCN files code of default onlineRanking
    Code:
        private function _onlineRanking() {
            switch($this->serverFiles) {
                case "MUE":
                    if($this->config['SQL_USE_2_DB']) {
                        $muLogEx = $this->me->query_fetch("SELECT TOP ".$this->_results." "._CLMN_LOGEX_ACCID_.", sum("._CLMN_LOGEX_OD_.") as TotalOnlineTime FROM "._TBL_LOGEX_." GROUP BY "._CLMN_LOGEX_ACCID_." ORDER BY TotalOnlineTime DESC");
                        if(is_array($muLogEx)) {
                            $result = array();
                            $character = new Character();
                            foreach($muLogEx as $key => $thisUser) {
                                $characterName = $character->AccountCharacterIDC($thisUser[_CLMN_LOGEX_ACCID_]);
                                $characterData = $character->CharacterData($characterName);
                                $result[$key] = array($characterName, $thisUser['TotalOnlineTime'], $characterData[_CLMN_CHR_CLASS_]);
                            }
                        }
                    } else {
                        $result = $this->mu->query_fetch("SELECT TOP ".$this->_results." tb2."._CLMN_GAMEIDC_.", sum(tb1."._CLMN_LOGEX_OD_.") AS TotalOnlineDuration, tb3."._CLMN_CHR_CLASS_." FROM "._TBL_LOGEX_." AS tb1 INNER JOIN "._TBL_AC_." AS tb2 ON tb1."._CLMN_LOGEX_ACCID_." = tb2."._CLMN_AC_ID_." INNER JOIN "._TBL_CHR_." AS tb3 ON tb2."._CLMN_GAMEIDC_." = tb3."._CLMN_CHR_NAME_." WHERE tb3."._CLMN_CHR_NAME_." NOT IN(".$this->_rankingsExcludeChars().") GROUP BY tb1."._CLMN_LOGEX_ACCID_.", tb2."._CLMN_GAMEIDC_.", tb3."._CLMN_CHR_CLASS_." ORDER BY TotalOnlineDuration DESC");
                    }
                    break;
                default:
                    return;
            }
            if(!is_array($result)) return;
     
            $cache = BuildCacheData($result);
            UpdateCache('rankings_online.cache',$cache);
        }
    
    Because when I copied gens_ranking and customize it, than online ranking started listing players
    Code:
          private function _onlineRanking() {
            switch($this->serverFiles) {
                case "IGCN":
                    $result = $this->mu->query_fetch("SELECT TOP ".$this->_results." tb2."._CLMN_GAMEIDC_.", sum(tb1."._CLMN_LOGEX_OD_.") AS TotalOnlineDuration, tb3."._CLMN_CHR_CLASS_." FROM "._TBL_LOGEX_." AS tb1 INNER JOIN "._TBL_AC_." AS tb2 ON tb1."._CLMN_LOGEX_ACCID_." = tb2."._CLMN_AC_ID_." INNER JOIN "._TBL_CHR_." AS tb3 ON tb2."._CLMN_GAMEIDC_." = tb3."._CLMN_CHR_NAME_." WHERE tb3."._CLMN_CHR_NAME_." NOT IN(".$this->_rankingsExcludeChars().") GROUP BY tb1."._CLMN_LOGEX_ACCID_.", tb2."._CLMN_GAMEIDC_.", tb3."._CLMN_CHR_CLASS_." ORDER BY TotalOnlineDuration DESC");
                
                    break;
                default:
                    return;
            }
            if(!is_array($result)) return;
        
            $cache = BuildCacheData($result);
            UpdateCache('rankings_online.cache',$cache);
        }
    


    But I've got new problem
    [​IMG]
    Line 68
    echo '<td>'.round($rdata[1]/60/60).' '.lang('rankings_txt_16',true).'</td>';
    After changing it on
    echo '<td>'.round($rdata[1]).' '.lang('rankings_txt_16',true).'</td>';
    I think than I should see seconds online, but still 0
    [​IMG]
     
    Last edited: Feb 1, 2018
  4. Lautaro

    Lautaro Administrator Developer

    The online ranking query is only available for MUE files, not IGCN. You basically have to add your own query for it to work.
     

Share This Page