1. Соблюдайте Правила форума и проявляйте уважение к другим участникам беседы.

Возжелайте, и да будет вам дано

Тема в разделе 'Кодинг/Собственные решения', создана пользователем Synth (LM), 29 мар 2011.

  1. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Все из-за разных версий... ;(
  2. ____ROB____ Старожила

    Сообщения:
    1.008
    Спасибы:
    22
    Сборка бота GHost:
    Ghost One 1.5
    может в поиске, добавить строку "поиск по названию игры"...
    ___________________________________________________
    ну ето не важно впринцыпе, флажок ето мелочи. :)
  3. rost Гуру

    Сообщения:
    1.258
    Спасибы:
    150
    Сборка бота GHost:
    LtG
    Дата начала использования бота:
    01.11.2010
    Skype:
    Мой статус
    Лонг плз я уже писал, помоги со "Cтатистика за все время" - неработает, мб чтото в дефолте нетак, ну или я скачал заного, но 1 фиг непашет. Мб дето чтото просто нетак стоит.
    Потом еще такая же лажа с дисконами... тоесть тоже по нулям. Ливов 10, а % как всегда на нуле.
    И у тя еще прикольно разделено на ливы и дисконы. Так как у мну это важно тошо пользуюсь варнами, неподскажешь как зделать.
  4. D-MiLIR Ньюфаг

    Сообщения:
    109
    Спасибы:
    0
    LongMan

    Вопрос: Почему при наводки курсора на колонку PTS и т.д. не выплывает окошко с расшифровкой.

    P.S Диаграмму сделал :alequate:
  5. rost Гуру

    Сообщения:
    1.258
    Спасибы:
    150
    Сборка бота GHost:
    LtG
    Дата начала использования бота:
    01.11.2010
    Skype:
    Мой статус
    СпС ЛонГ за все темы... все получилось, хотя до оптимизации заочковал из за 30 секкунд прогруза место 4, но вспомнил что есть выход :alequate:
    =-=-=-=-=-=-=-=-
    Неподскажешь как зделать колонку какой бот создал? там по id я понял ток дето недопихую чет :stenka:
    --------------
    Как добавить возможность коментировать игрока? Т.к. это пхп я немного хз прокатит ли то что и с обычным html
    И есть идейка по добавлению возможности коментария игр =) Мне кажитсо могут завязатсо веселые разговоры =)
    Ну или козлячие разборки, и то и то весело)))
  6. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Сделай в language.cfg:

    Допиши в конец каждой строки, где вылазит ошибка интернета, слово "ERR".

    Затем иди в common.php.

    Ищешь и заменяешь на это:

    Код:
    	 , SUM(
    	 (gp.`leftreason` LIKE ('%has lost the connection%'))  
    	 OR (gp.`leftreason` LIKE ('%was dropped%')) 
    	 OR (gp.`leftreason` LIKE ('%Lagged out%')) 
    	 OR (gp.`leftreason` LIKE ('%ERR%'))
    	 OR (gp.`leftreason` LIKE ('%Lost the connection%'))
    	 ) as disc 
    Старые дисконекты уже не вернуть (или мучайся с кодировкой сам (если у тебя на русском)), но зато новые будут видны.
  7. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Не копирую свой сайт, точнее части своего сайта. Некоторые могу, но эту не буду.


    games.php

    Find
    Код:
        include('pagination.php');
    	
      $sql = "SELECT 
              g.id, map, datetime, gamename, creatorname, duration, ownername, dg.winner, subnull, g.views,
    		  CASE WHEN(gamestate = '17') THEN 'PRIV' ELSE 'PUB' end AS type 
    		  FROM games as g 
    		  LEFT JOIN dotagames as dg ON g.id = dg.gameid 
    		  WHERE map LIKE '%dota%' $sql_year $sql_month $sql_day
    		  ORDER BY $order $sortdb 
    		  LIMIT $offset, $rowsperpage";
      
      $result = $db->query($sql);
    Replace
    Код:
        include('pagination.php');
    	
      $sql = "SELECT 
              g.id, g.botid, map, datetime, gamename, creatorname, duration, ownername, dg.winner, subnull, g.views,
    		  CASE WHEN(gamestate = '17') THEN 'PRIV' ELSE 'PUB' end AS type 
    		  FROM games as g 
    		  LEFT JOIN dotagames as dg ON g.id = dg.gameid 
    		  WHERE map LIKE '%dota%' $sql_year $sql_month $sql_day
    		  ORDER BY $order $sortdb 
    		  LIMIT $offset, $rowsperpage";
      
      $result = $db->query($sql);
    Find
    Код:
      <th><a href='{$_SERVER['PHP_SELF']}?order=creator&sort=$sort'>$lang[creator]</a></th>
    Type in bot
    Код:
      <th>$lang[host]</th>
    PS: Надеюсь догадаешся как добавить новое значение в массив языкового файла...

    Find

    Код:
    $duration=secondsToTime($list["duration"]);
    Place into next line
    Код:
    $botid=trim($list["botid"]);
    And again place into next line

    Код:
    	if ($botid == 0)
    	$host = 'HOST1';
    	if ($botid == 1)
    	$host = 'HOST2;
    
    Find
    Код:
    <td width='200px'><div align='left'><a href='user.php?u=$creator2'>$creator</a></div></td>
    Place to next line
    Код:
    <td width='40px'><div align='left'>$host</div></td>
    It's all.
  8. rost Гуру

    Сообщения:
    1.258
    Спасибы:
    150
    Сборка бота GHost:
    LtG
    Дата начала использования бота:
    01.11.2010
    Skype:
    Мой статус
    Лонг а поповоду коментов хелпанеш?
    ----------------
    опять же спс что время уделил :prayy:
  9. ____ROB____ Старожила

    Сообщения:
    1.008
    Спасибы:
    22
    Сборка бота GHost:
    Ghost One 1.5
    хотел уточнить:

    ты про ланг который в боте? /ghost/lang/...



    должно получится так:
    lang_0079 = потерял соединение (ошибка игрока - $ERROR$) "ERR" ? (ну и другие строки)
  10. rost Гуру

    Сообщения:
    1.258
    Спасибы:
    150
    Сборка бота GHost:
    LtG
    Дата начала использования бота:
    01.11.2010
    Skype:
    Мой статус
    Ок. Можешь хоть помочь с переменной leave ?
    Ну если конкретно то ты в 1 теме советовал создать колонку advscore, а я хотел создать еще 1 типа leavescore, но чтоб в не данные брались с ливов, с ихнего кол-ва ===> как ее прировнять к ливам подскажешь если несложно?
  11. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Да, можно без кавычек.
  12. ____ROB____ Старожила

    Сообщения:
    1.008
    Спасибы:
    22
    Сборка бота GHost:
    Ghost One 1.5
    Хотел создавать страничку на подобии TOP.PHP, но что бы в етом топе отображалась статистика только для игроков - safe list, admin, root admin. ^-^
  13. rost Гуру

    Сообщения:
    1.258
    Спасибы:
    150
    Сборка бота GHost:
    LtG
    Дата начала использования бота:
    01.11.2010
    Skype:
    Мой статус
    Лонг ток вот хз как мне ботов то добавить????
    У мну в БД тока 1 id = 0
    Нужно парочку еще ботов, но как им айди придать...
    Как еще ботов присабачить? :patsak:
    --------
    для справки все боты на 1 компе, ну если это важно.
  14. Apx Ньюфаг

    Сообщения:
    165
    Спасибы:
    0
    А разве не в конфиге прописать botid = 1 ?
  15. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Код:
    db_mysql_botid = 1
  16. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Скопируй top.php, потом лезь в common.php:

    Пишешь в начало файла:

    Код:
    	     function getTopsOnlyAdmins($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop){
    	 if ($DBScore == 0)
        {
    	    if ($ScoreMethod == 2) 
    		{$scoreFormula = "$ScoreStart + (wins*$ScoreWins) + (losses*$ScoreLosses) + (disc*$ScoreDisc)";}
    		
    	    if ($HideBannedUsersOnTop == 1) {$_sql = "AND bans.name is null";} else {$_sql = "";}
    		
    	$text = "
    	SELECT *, 
    	case when (kills = 0) then 0 
    	when (deaths = 0) then 1000 
    	else ((kills*1.0)/(deaths*1.0)) end as killdeathratio, 
    	($scoreFormula) as totalscore 
    	 FROM ( 
    	 SELECT 
    	 gp.name as name, 
    	 bans.name as banname, 
    	 avg(dp.courierkills) as courierkills, 
    	 avg(dp.raxkills) as raxkills,
    	 avg(dp.towerkills) as towerkills, 
    	 avg(dp.assists) as assists, 
    	 avg(dp.creepdenies) as creepdenies, 
    	 avg(dp.creepkills) as creepkills,
    	 avg(dp.neutralkills) as neutralkills, 
    	 avg(gp.left) as avgleft, avg(ga.duration) as avgduration,
    	 avg(dp.deaths) as deaths, 
    	 avg(dp.kills) as kills, 
    	 SUM(dp.kills) as totkills,
    	 SUM(dp.deaths) as totdeaths,
    	 COUNT(*) as totgames, 
    	 case when (kills = 0) then 0 
    	 when (deaths = 0) then 1000 
    	 else ((kills*1.0)/(deaths*1.0)) 
    	 end as killdeathratio,
    	 SUM(case when(((dg.winner = 1 and dp.newcolour < 6) 
    	 or (dg.winner = 2 and dp.newcolour > 6)) 
         AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 
    	 else 0 end) as wins, 
         SUM(case when(((dg.winner = 2 and dp.newcolour < 6) 
    	 or (dg.winner = 1 and dp.newcolour > 6)) 
         AND gp.`left`/ga.duration >= $minPlayedRatio) 
    	 then 1 else 0 end) as losses
    	 
    	 , SUM(
    	 (gp.`leftreason` LIKE ('%has lost the connection%'))  
    	 OR (gp.`leftreason` LIKE ('%was dropped%')) 
    	 OR (gp.`leftreason` LIKE ('%Lagged out%')) 
    	 OR (gp.`leftreason` LIKE ('%ERR %'))
    	 OR (gp.`leftreason` LIKE ('%Lost the connection%'))
    	 ) as disc 
    	 
     FROM gameplayers as gp 
    		  LEFT JOIN dotagames as dg ON gp.gameid = dg.gameid 
    		  LEFT JOIN admins as ad ON ad.name = gp.name 
    		  LEFT JOIN dotaplayers as dp ON dg.gameid = dp.gameid 
    		  AND gp.colour = dp.colour 
    		  AND dp.newcolour <> 12 
    		  AND dp.newcolour <> 6
    		  LEFT JOIN games as ga ON dp.gameid = ga.id 
    		  LEFT JOIN scores as sc ON sc.name = gp.name 
    		  LEFT JOIN bans on bans.name = gp.name 
    		  WHERE dg.winner <> 0 $_sql AND gp.name = ad.name
    		  GROUP BY gp.name having totgames >= $games) as i 
    	 ORDER BY $order $sortdb, name $sortdb 
    	 LIMIT $offset, $rowsperpage";}
    	 else
    	 {
    	 if ($HideBannedUsersOnTop == 1) {$_sql = "AND bans.name is null";} else {$_sql = "";}
    	 
    	 $text = "
    	 SELECT *, 
    	 case when (kills = 0) then 0 
    	 when (deaths = 0) then 1000 
    	 else ((kills*1.0)/(deaths*1.0)) 
    	 end as killdeathratio 
    	 FROM (
              SELECT gp.name as name, 
    		  bans.name as banname, 
    		  avg(dp.courierkills) as courierkills, 
    		  avg(dp.raxkills) as raxkills,
    		  avg(dp.towerkills) as towerkills, 
    		  avg(dp.assists) as assists, 
    		  avg(dp.creepdenies) as creepdenies, 
    		  avg(dp.creepkills) as creepkills,
    		  avg(dp.neutralkills) as neutralkills, 
    		  avg(dp.deaths) as deaths, 
    		  avg(dp.kills) as kills, 
    		  SUM(dp.kills) as totkills,
    	      SUM(dp.deaths) as totdeaths,
    		  sc.score as totalscore, 
    		  COUNT(*) as totgames, 
    		  SUM(case when(((dg.winner = 1 and dp.newcolour < 6) 
    		  or (dg.winner = 2 and dp.newcolour > 6)) 
    		  AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 else 0 end) as wins, 
    		  SUM(case when(((dg.winner = 2 and dp.newcolour < 6) 
    		  or (dg.winner = 1 and dp.newcolour > 6)) 
    		  AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 else 0 end) as losses
    		  
    		  , SUM(
    	 (gp.`leftreason` LIKE ('%has lost the connection%'))  
    	 OR (gp.`leftreason` LIKE ('%was dropped%')) 
    	 OR (gp.`leftreason` LIKE ('%Lagged out%')) 
    	 OR (gp.`leftreason` LIKE ('%ERR %'))
    	 OR (gp.`leftreason` LIKE ('%Lost the connection%'))
    	 ) as disc 
    		  
    		  FROM gameplayers as gp 
    		  LEFT JOIN dotagames as dg ON gp.gameid = dg.gameid 
    		  LEFT JOIN admins as ad ON ad.name = gp.name 
    		  LEFT JOIN dotaplayers as dp ON dg.gameid = dp.gameid 
    		  AND gp.colour = dp.colour 
    		  AND dp.newcolour <> 12 
    		  AND dp.newcolour <> 6
    		  LEFT JOIN games as ga ON dp.gameid = ga.id 
    		  LEFT JOIN scores as sc ON sc.name = gp.name 
    		  LEFT JOIN bans on bans.name = gp.name 
    		  WHERE dg.winner <> 0 $_sql AND gp.name = ad.name
    		  GROUP BY gp.name having totgames >= $games) as i 
    		  
    	 ORDER BY $order $sortdb, name $sortdb 
    	 LIMIT $offset, $rowsperpage";
    	 }
    	 
    	 return $text;
    }  
    Вернемся в top_admins.php:

    Код:
    	 $sql = getTops($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop);
    На
    Код:
    	 $sql = getTopsOnlyAdmins($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop);
    Затем лезем в common.php и дописываем
    Код:
                  function getCountTops2($games,$HideBannedUsersOnTop){
        if ($HideBannedUsersOnTop != '0')
        $_sql = " AND gp.name NOT IN (SELECT name FROM bans) ";
      else
        $_sql = "";
        $count = "
      SELECT COUNT(*) as count 
      FROM( 
           SELECT gp.name 
          FROM gameplayers as gp, 
          dotagames as dg, 
          games as ga,
          admins as ad,
          dotaplayers as dp 
          WHERE dg.winner <> 0 
          AND dp.gameid = gp.gameid 
          AND dg.gameid = dp.gameid 
          AND dp.gameid = ga.id 
          AND gp.gameid = dg.gameid 
          AND gp.name = ad.name
          AND gp.colour = dp.colour 
          $_sql 
          GROUP BY gp.name having count(*) >= $games
         ) as h
      LIMIT 1";
      
      return $count;
        }
      
    А рутадминов добавь в список админов с любыми правами.
  17. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Сейчас напишем.
  18. ____ROB____ Старожила

    Сообщения:
    1.008
    Спасибы:
    22
    Сборка бота GHost:
    Ghost One 1.5
    скопировал top.php в top_sf.php.
    добавил в top_sf.php твою строку.

    в соmmon.php добавлил сразу после:
    Код:
    -->
    **********************************************/
    Код:
            function getTopsOnlyAdmins($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop){
        if ($DBScore == 0)
        {
           if ($ScoreMethod == 2) 
          {$scoreFormula = "$ScoreStart + (wins*$ScoreWins) + (losses*$ScoreLosses) + (disc*$ScoreDisc)";}
          
           if ($HideBannedUsersOnTop == 1) {$_sql = "AND bans.name is null";} else {$_sql = "";}
          
       $text = "
       SELECT *, 
       case when (kills = 0) then 0 
       when (deaths = 0) then 1000 
       else ((kills*1.0)/(deaths*1.0)) end as killdeathratio, 
       ($scoreFormula) as totalscore 
        FROM ( 
        SELECT 
        gp.name as name, 
        bans.name as banname, 
        avg(dp.courierkills) as courierkills, 
        avg(dp.raxkills) as raxkills,
        avg(dp.towerkills) as towerkills, 
        avg(dp.assists) as assists, 
        avg(dp.creepdenies) as creepdenies, 
        avg(dp.creepkills) as creepkills,
        avg(dp.neutralkills) as neutralkills, 
        avg(gp.left) as avgleft, avg(ga.duration) as avgduration,
        avg(dp.deaths) as deaths, 
        avg(dp.kills) as kills, 
        SUM(dp.kills) as totkills,
        SUM(dp.deaths) as totdeaths,
        COUNT(*) as totgames, 
        case when (kills = 0) then 0 
        when (deaths = 0) then 1000 
        else ((kills*1.0)/(deaths*1.0)) 
        end as killdeathratio,
        SUM(case when(((dg.winner = 1 and dp.newcolour < 6) 
        or (dg.winner = 2 and dp.newcolour > 6)) 
         AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 
        else 0 end) as wins, 
         SUM(case when(((dg.winner = 2 and dp.newcolour < 6) 
        or (dg.winner = 1 and dp.newcolour > 6)) 
         AND gp.`left`/ga.duration >= $minPlayedRatio) 
        then 1 else 0 end) as losses
        
        , SUM(
        (gp.`leftreason` LIKE ('%has lost the connection%'))  
        OR (gp.`leftreason` LIKE ('%was dropped%')) 
        OR (gp.`leftreason` LIKE ('%Lagged out%')) 
        OR (gp.`leftreason` LIKE ('%ERR %'))
        OR (gp.`leftreason` LIKE ('%Lost the connection%'))
        ) as disc 
        
    FROM gameplayers as gp 
            LEFT JOIN dotagames as dg ON gp.gameid = dg.gameid 
            LEFT JOIN admins as ad ON ad.name = gp.name 
            LEFT JOIN dotaplayers as dp ON dg.gameid = dp.gameid 
            AND gp.colour = dp.colour 
            AND dp.newcolour <> 12 
            AND dp.newcolour <> 6
            LEFT JOIN games as ga ON dp.gameid = ga.id 
            LEFT JOIN scores as sc ON sc.name = gp.name 
            LEFT JOIN bans on bans.name = gp.name 
            WHERE dg.winner <> 0 $_sql AND gp.name = ad.name
            GROUP BY gp.name having totgames >= $games) as i 
        ORDER BY $order $sortdb, name $sortdb 
        LIMIT $offset, $rowsperpage";}
        else
        {
        if ($HideBannedUsersOnTop == 1) {$_sql = "AND bans.name is null";} else {$_sql = "";}
        
        $text = "
        SELECT *, 
        case when (kills = 0) then 0 
        when (deaths = 0) then 1000 
        else ((kills*1.0)/(deaths*1.0)) 
        end as killdeathratio 
        FROM (
              SELECT gp.name as name, 
            bans.name as banname, 
            avg(dp.courierkills) as courierkills, 
            avg(dp.raxkills) as raxkills,
            avg(dp.towerkills) as towerkills, 
            avg(dp.assists) as assists, 
            avg(dp.creepdenies) as creepdenies, 
            avg(dp.creepkills) as creepkills,
            avg(dp.neutralkills) as neutralkills, 
            avg(dp.deaths) as deaths, 
            avg(dp.kills) as kills, 
            SUM(dp.kills) as totkills,
             SUM(dp.deaths) as totdeaths,
            sc.score as totalscore, 
            COUNT(*) as totgames, 
            SUM(case when(((dg.winner = 1 and dp.newcolour < 6) 
            or (dg.winner = 2 and dp.newcolour > 6)) 
            AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 else 0 end) as wins, 
            SUM(case when(((dg.winner = 2 and dp.newcolour < 6) 
            or (dg.winner = 1 and dp.newcolour > 6)) 
            AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 else 0 end) as losses
            
            , SUM(
        (gp.`leftreason` LIKE ('%has lost the connection%'))  
        OR (gp.`leftreason` LIKE ('%was dropped%')) 
        OR (gp.`leftreason` LIKE ('%Lagged out%')) 
        OR (gp.`leftreason` LIKE ('%ERR %'))
        OR (gp.`leftreason` LIKE ('%Lost the connection%'))
        ) as disc 
            
            FROM gameplayers as gp 
            LEFT JOIN dotagames as dg ON gp.gameid = dg.gameid 
            LEFT JOIN admins as ad ON ad.name = gp.name 
            LEFT JOIN dotaplayers as dp ON dg.gameid = dp.gameid 
            AND gp.colour = dp.colour 
            AND dp.newcolour <> 12 
            AND dp.newcolour <> 6
            LEFT JOIN games as ga ON dp.gameid = ga.id 
            LEFT JOIN scores as sc ON sc.name = gp.name 
            LEFT JOIN bans on bans.name = gp.name 
            WHERE dg.winner <> 0 $_sql AND gp.name = ad.name
            GROUP BY gp.name having totgames >= $games) as i 
            
        ORDER BY $order $sortdb, name $sortdb 
        LIMIT $offset, $rowsperpage";
        }
        
        return $text;
    }  

    вот выдаёт...
    [IMG]
  19. Synth (LM) Пантограф!

    Сообщения:
    2.762
    Спасибы:
    172
    Сборка бота GHost:
    My own version of GhostOne
    Дата начала использования бота:
    15.06.2008
    Skype:
    Мой статус
    Ой ой ой, провал...

    Замени на
    Код:
      $sql = getCountTops2($games);
    А ниже

    Код:
    	 $sql = getTops($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop);
    На
    Код:
    	 $sql = getTopsOnlyAdmins($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop);
    Затем лезем в common.php и дописываем
    Код:
        function getCountTops2($games,$HideBannedUsersOnTop){
    	 if ($HideBannedUsersOnTop != '0')
        $_sql = " AND gp.name NOT IN (SELECT name FROM bans) ";
      else
        $_sql = "";
    	 $count = "
      SELECT COUNT(*) as count 
      FROM( 
           SELECT name 
    	   FROM gameplayers as gp, 
    	   dotagames as dg, 
    	   games as ga,
    	   admins as ad,
    	   dotaplayers as dp 
    	   WHERE dg.winner <> 0 
    	   AND dp.gameid = gp.gameid 
    	   AND dg.gameid = dp.gameid 
    	   AND dp.gameid = ga.id 
    	   AND gp.gameid = dg.gameid 
    	   AND gp.name = ad.name
    	   AND gp.colour = dp.colour 
    	   $_sql 
    	   GROUP BY gp.name having count(*) >= $games
    	  ) as h
      LIMIT 1";
      
      return $count;
    	 }
  20. ____ROB____ Старожила

    Сообщения:
    1.008
    Спасибы:
    22
    Сборка бота GHost:
    Ghost One 1.5
    зашол в top_sf.php, заменил " $sql = getCountTops($games,$HideBannedUsersOnTop);" на
    Код:
      $sql = getCountTops2($games);
    опустился ниже заменил
    Код:
        $sql = getTops($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop);
    на
    Код:
        $sql = getTopsOnlyAdmins($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop);

    зашол в commin.php, добавил после -
    Код:
    -->
    **********************************************/
    вот ето -
    Код:
     function getTopsOnlyAdmins($scoreFormula,$minPlayedRatio,$games,$order,$sortdb,$offset,$rowsperpage,$DBScore,$ScoreMethod,$ScoreWins,$ScoreLosses,$ScoreDisc,$ScoreStart,$HideBannedUsersOnTop){
        if ($DBScore == 0)
        {
           if ($ScoreMethod == 2) 
          {$scoreFormula = "$ScoreStart + (wins*$ScoreWins) + (losses*$ScoreLosses) + (disc*$ScoreDisc)";}
          
           if ($HideBannedUsersOnTop == 1) {$_sql = "AND bans.name is null";} else {$_sql = "";}
          
       $text = "
       SELECT *, 
       case when (kills = 0) then 0 
       when (deaths = 0) then 1000 
       else ((kills*1.0)/(deaths*1.0)) end as killdeathratio, 
       ($scoreFormula) as totalscore 
        FROM ( 
        SELECT 
        gp.name as name, 
        bans.name as banname, 
        avg(dp.courierkills) as courierkills, 
        avg(dp.raxkills) as raxkills,
        avg(dp.towerkills) as towerkills, 
        avg(dp.assists) as assists, 
        avg(dp.creepdenies) as creepdenies, 
        avg(dp.creepkills) as creepkills,
        avg(dp.neutralkills) as neutralkills, 
        avg(gp.left) as avgleft, avg(ga.duration) as avgduration,
        avg(dp.deaths) as deaths, 
        avg(dp.kills) as kills, 
        SUM(dp.kills) as totkills,
        SUM(dp.deaths) as totdeaths,
        COUNT(*) as totgames, 
        case when (kills = 0) then 0 
        when (deaths = 0) then 1000 
        else ((kills*1.0)/(deaths*1.0)) 
        end as killdeathratio,
        SUM(case when(((dg.winner = 1 and dp.newcolour < 6) 
        or (dg.winner = 2 and dp.newcolour > 6)) 
         AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 
        else 0 end) as wins, 
         SUM(case when(((dg.winner = 2 and dp.newcolour < 6) 
        or (dg.winner = 1 and dp.newcolour > 6)) 
         AND gp.`left`/ga.duration >= $minPlayedRatio) 
        then 1 else 0 end) as losses
        
        , SUM(
        (gp.`leftreason` LIKE ('%has lost the connection%'))  
        OR (gp.`leftreason` LIKE ('%was dropped%')) 
        OR (gp.`leftreason` LIKE ('%Lagged out%')) 
        OR (gp.`leftreason` LIKE ('%ERR %'))
        OR (gp.`leftreason` LIKE ('%Lost the connection%'))
        ) as disc 
        
    FROM gameplayers as gp 
            LEFT JOIN dotagames as dg ON gp.gameid = dg.gameid 
            LEFT JOIN admins as ad ON ad.name = gp.name 
            LEFT JOIN dotaplayers as dp ON dg.gameid = dp.gameid 
            AND gp.colour = dp.colour 
            AND dp.newcolour <> 12 
            AND dp.newcolour <> 6
            LEFT JOIN games as ga ON dp.gameid = ga.id 
            LEFT JOIN scores as sc ON sc.name = gp.name 
            LEFT JOIN bans on bans.name = gp.name 
            WHERE dg.winner <> 0 $_sql AND gp.name = ad.name
            GROUP BY gp.name having totgames >= $games) as i 
        ORDER BY $order $sortdb, name $sortdb 
        LIMIT $offset, $rowsperpage";}
        else
        {
        if ($HideBannedUsersOnTop == 1) {$_sql = "AND bans.name is null";} else {$_sql = "";}
        
        $text = "
        SELECT *, 
        case when (kills = 0) then 0 
        when (deaths = 0) then 1000 
        else ((kills*1.0)/(deaths*1.0)) 
        end as killdeathratio 
        FROM (
              SELECT gp.name as name, 
            bans.name as banname, 
            avg(dp.courierkills) as courierkills, 
            avg(dp.raxkills) as raxkills,
            avg(dp.towerkills) as towerkills, 
            avg(dp.assists) as assists, 
            avg(dp.creepdenies) as creepdenies, 
            avg(dp.creepkills) as creepkills,
            avg(dp.neutralkills) as neutralkills, 
            avg(dp.deaths) as deaths, 
            avg(dp.kills) as kills, 
            SUM(dp.kills) as totkills,
             SUM(dp.deaths) as totdeaths,
            sc.score as totalscore, 
            COUNT(*) as totgames, 
            SUM(case when(((dg.winner = 1 and dp.newcolour < 6) 
            or (dg.winner = 2 and dp.newcolour > 6)) 
            AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 else 0 end) as wins, 
            SUM(case when(((dg.winner = 2 and dp.newcolour < 6) 
            or (dg.winner = 1 and dp.newcolour > 6)) 
            AND gp.`left`/ga.duration >= $minPlayedRatio) then 1 else 0 end) as losses
            
            , SUM(
        (gp.`leftreason` LIKE ('%has lost the connection%'))  
        OR (gp.`leftreason` LIKE ('%was dropped%')) 
        OR (gp.`leftreason` LIKE ('%Lagged out%')) 
        OR (gp.`leftreason` LIKE ('%ERR %'))
        OR (gp.`leftreason` LIKE ('%Lost the connection%'))
        ) as disc 
            
            FROM gameplayers as gp 
            LEFT JOIN dotagames as dg ON gp.gameid = dg.gameid 
            LEFT JOIN admins as ad ON ad.name = gp.name 
            LEFT JOIN dotaplayers as dp ON dg.gameid = dp.gameid 
            AND gp.colour = dp.colour 
            AND dp.newcolour <> 12 
            AND dp.newcolour <> 6
            LEFT JOIN games as ga ON dp.gameid = ga.id 
            LEFT JOIN scores as sc ON sc.name = gp.name 
            LEFT JOIN bans on bans.name = gp.name 
            WHERE dg.winner <> 0 $_sql AND gp.name = ad.name
            GROUP BY gp.name having totgames >= $games) as i 
            
        ORDER BY $order $sortdb, name $sortdb 
        LIMIT $offset, $rowsperpage";
        }
        
        return $text;
    }  

    сразу после выше указано кода, добавил етот -
    Код:
        function getCountTops2($games,$HideBannedUsersOnTop){
        if ($HideBannedUsersOnTop != '0')
        $_sql = " AND gp.name NOT IN (SELECT name FROM bans) ";
      else
        $_sql = "";
        $count = "
      SELECT COUNT(*) as count 
      FROM( 
           SELECT name 
          FROM gameplayers as gp, 
          dotagames as dg, 
          games as ga,
          admins as ad,
          dotaplayers as dp 
          WHERE dg.winner <> 0 
          AND dp.gameid = gp.gameid 
          AND dg.gameid = dp.gameid 
          AND dp.gameid = ga.id 
          AND gp.gameid = dg.gameid 
          AND gp.name = ad.name
          AND gp.colour = dp.colour 
          $_sql 
          GROUP BY gp.name having count(*) >= $games
         ) as h
      LIMIT 1";
      
      return $count;
        }
    вот -
    [IMG]

    что я делаю не так?! :opasnoste: