$spl = explode("|", $_GET[users][$i]); echo $spl[0] . " --> " . displaySmurf(getPlayerId($spl[0])) . "\n"; } //echo "\nIf you like !smurfs please support it by voting here http://taspring.clan-sy.com/phpbb/viewtopic.php?t=8662\n"; exit; } } function displaySmurf($id) { $ret = ""; $res = mysql_query("SELECT name, lastSeen, rank FROM Players AS p JOIN Players2ip AS i ON p.id = i.playerId WHERE ip IN (SELECT ip FROM Players2ip WHERE playerId={$id}) GROUP BY playerId ORDER BY name"); $cnt = 0; while ($row = mysql_fetch_array($res)) { if ($row[rank] == 0) { $row[rank] = "?"; } if ($cnt > 0) { $ret .= ", "; } $ret .= $row[name] . " (r:{$row['rank']}, " . timeDiff(time() - $row[lastSeen]) . ")"; $cnt++; } return $ret; } $ida = filterPlayers($p); $id = $ida[0]; if ($id == 0) { exit("No such player found in database."); } echo displaySmurf($id) . "\n"; //echo "\nIf you like !smurfs please support it by voting here http://taspring.clan-sy.com/phpbb/viewtopic.php?t=8662\n";
echo $i . ". {$row['name']} ({$row['cnt']} games, for total " . timeDiff($row[sum]) . " - average game took " . timeDiff($row[avg]) . " and had " . round($row[plr]) . " players)\n"; $i++; } $res = mysql_query("SELECT name, count(*) as cnt, avg(duration) as avg, sum(duration) AS sum, avg(players) AS plr FROM Games JOIN Maps ON mapId = Maps.id GROUP BY mapId ORDER BY sum DESC LIMIT 0,20"); echo "== Globally most popular maps ==\n"; $i = 1; while ($row = mysql_fetch_array($res)) { echo $i . ". {$row['name']} ({$row['cnt']} games, for total " . timeDiff($row[sum]) . " - average game took " . timeDiff($row[avg]) . " and had " . round($row[plr]) . " players)\n"; $i++; } break; case "player": if ($args[1] == "") { $args[1] = $_GET[user]; } $ida = filterPlayers(glue($args, 1)); $pid = $ida[0]; if ($pid == 0) { exit("this player has no games in database yet\n"); } $total = mysql_result(mysql_query("SELECT count(*) FROM Games2players WHERE playerId = {$pid} AND spectator=0"), 0, 0); $wins = mysql_result(mysql_query("SELECT count(*) FROM Games2players WHERE playerId = {$pid} AND spectator=0 AND victoryTeam=1 AND aliveTillEnd=1"), 0, 0); $quit = mysql_result(mysql_query("SELECT count(*) FROM Games2players WHERE playerId = {$pid} AND spectator=0 AND (dropTime<>0 OR leaveTime<>0) AND (dropTime < loseTime OR leaveTime < loseTime)"), 0, 0); @(print getPlayerName($pid) . " - skill rating:" . eloToText($pid) . ", played {$total} games, has won " . round(100 * $wins / $total) . "% and quit " . round(100 * $quit / $total) . "%\n"); $res = mysql_query("SELECT name, sum(duration) AS sum FROM Games JOIN Maps ON mapId = Maps.id AND Games.id IN (SELECT distinct gameId AS cnt FROM Games2players WHERE playerId={$pid}) GROUP BY mapId ORDER BY sum DESC LIMIT 0,5 "); echo "most played MAPS are:\n"; $i = 1; while ($row = mysql_fetch_array($res)) { echo $i . ". {$row['name']} - " . timeDiff($row[sum]) . "\n"; $i++; }