query($query); list($total_kills, $total_headshots) = $db->fetch_row($result); $query= " SELECT serverId, name, IF(publicaddress != '', publicaddress, concat(address, ':', port) ) AS addr, statusurl, kills, players, rounds, suicides, headshots, bombs_planted, bombs_defused, ct_wins, ts_wins, ct_shots, ct_hits, ts_shots, ts_hits, act_players, max_players, act_map, map_started, map_ct_wins, map_ts_wins, game FROM hlstats_Servers WHERE serverId='$server_id' "; $result = $db->query($query); $servers = array(); $servers[] = $db->fetch_array($result); ?> query(" SELECT team, name, teamkills, teamdeaths, teamheadshots, teamping, teamskill, teamshots, teamhits, teamjointime, IFNULL(playerlist_bgcolor,'#D5D5D5') as playerlist_bgcolor, IFNULL(playerlist_color,'#050505') AS playerlist_color, IFNULL( playerlist_index, 99 ) AS playerlist_index FROM hlstats_Teams RIGHT JOIN (SELECT team, sum( kills ) AS teamkills, sum( deaths ) AS teamdeaths, sum( headshots ) AS teamheadshots, avg( ping /2 ) AS teamping, avg( skill ) AS teamskill, sum( shots ) AS teamshots, sum( hits ) AS teamhits, sum( unix_timestamp( NOW( ) ) - connected ) AS teamjointime FROM hlstats_Livestats WHERE server_id = $server_id AND connected >0 GROUP BY team ORDER BY teamkills ) teaminfo ON code = team AND hlstats_Teams.game = '$game' ORDER BY playerlist_index LIMIT 0 , 30 "); $teamdata = array(); $playerdata = array(); $teamno = 0; while ($thisteam = $db->fetch_array($statsdata)) { $teamname = $db->escape($thisteam['team']); $teamdata[$teamno] = $thisteam; $pldata = $db->query(" SELECT player_id, name, kills, deaths, headshots, ping, skill, shots, hits, connected, skill_change, cli_flag FROM hlstats_Livestats WHERE server_id = $server_id AND team = '$teamname' ORDER BY kills DESC "); while ($thisplayer = $db->fetch_array($pldata)) { $playerdata[$teamno][] = $thisplayer; } $teamno++; } $curteam = 0; while (isset($teamdata[$curteam])) { $j=0; $thisteam = $teamdata[$curteam]; $teamcolor = 'background:'.$thisteam['playerlist_bgcolor'].';color:'.$thisteam['playerlist_color']; $bordercolor = 'background:'.$$thisteam['playerlist_bgcolor'].';color:'.$thisteam['playerlist_color'].';border-top:1px '.$thisteam['playerlist_color'].' solid'; $team_display_name = htmlspecialchars($thisteam['name']); while (isset($playerdata[$curteam][$j])) { $thisplayer = $playerdata[$curteam][$j]; ?>
 #  Player  Kills  Hs  HS:K  Acc  Lat  Time  +/-  Skill
50) { $thisplayer['name'] = substr($thisplayer['name'], 0, 50); } if ($g_options['countrydata'] == 1) { echo ''.ucfirst(strtolower($thisplayer['cli_country'])).' '; } echo ''; echo htmlspecialchars($thisplayer['name'], ENT_COMPAT).''; } else { echo ' '; } ?> 0) { $hpk = sprintf('%.2f', $thisplayer['headshots']/$thisplayer['kills']); } echo $hpk; } else { echo ' '; } ?> 0) { $acc = sprintf('%.0f', ($thisplayer['hits']/$thisplayer['shots'])*100); } echo "$acc%"; } else { echo ' '; } ?> 0) { $stamp = time()-$thisplayer['connected']; $hours = sprintf('%02d', floor($stamp / 3600)); $min = sprintf('%02d', floor(($stamp % 3600) / 60)); $sec = sprintf('%02d', floor($stamp % 60)); echo $hours.':'.$min.':'.$sec; } else { echo 'Unknown'; } } else { echo ' '; } ?>
  $team_display_name"; if (($map_teama_wins > 0) || ($map_teamb_wins > 0)) { echo ' ('.$map_teama_wins.' wins)'; } ?> 0) { echo $teamdata[$curteam]['teamkills']; } else { echo ' '; } ?> 0) { echo ':'; } else { echo ' '; } ?> 0) { echo $teamdata[$curteam]['teamdeaths']; } else { echo ' '; } ?> 0) { echo $teamdata[$curteam]['teamheadshots']; } else { echo ' '; } ?> 0) { $hpk = sprintf('%.2f', 0); if ($teama_kills > 0) { $hpk = sprintf('%.2f', $teamdata[$curteam]['headshots']/$teamdata[$curteam]['kills']); } echo $hpk; } else { echo ' '; } ?> 0) { $acc = sprintf('%.0f', 0); if ($teama_shots > 0) { $acc = sprintf('%.0f', ($teamdata[$curteam]['teamhits']/$teamdata[$curteam]['teamshots'])*100); } echo "$acc%"; } else { echo ' '; } ?> 0) { echo sprintf('%.0f', $teamdata[$curteam]['teamping'] / count($teamdata[$curteam])); } else { echo ' '; } ?> 0) { if ($teamdata[$curteam]['teamjointime'] > 0) { $stamp = $teamdata[$curteam]['teamjointime']; $hours = sprintf('%02d', floor($stamp / 3600)); $min = sprintf('%02d', floor(($stamp % 3600) / 60)); $sec = sprintf('%02d', floor($stamp % 60)); echo $hours.':'.$min.':'.$sec; } else { echo 'Unknown'; } } else { echo ' '; } ?> - 0) { echo number_format(sprintf('%.0f', $teamdata[$curteam]['teamskill'])); } else { echo ' '; } ?>