function shame_medal_dynamite_deaths() { global $currentconfignumber; global $t; //table names global $wp_dynamite; global $text; $fname = __FUNCTION__; $ch = new cache($fname, $currentconfignumber); if ($ch->cval == 0) { $qry = "SELECT {$t['b3_clients']}.name, {$t['players']}.id, ip, {$t['b3_clients']}.time_edit, {$t['players']}.fixed_name, rounds, (SUM({$t['weaponusage']}.deaths) / {$t['players']}.rounds) AS total_deaths\r\n FROM {$t['weaponusage']}\r\n JOIN {$t['players']} ON {$t['weaponusage']}.player_id = {$t['players']}.id\r\n JOIN {$t['b3_clients']} ON {$t['players']}.client_id = {$t['b3_clients']}.id\r\n WHERE ({$t['weaponusage']}.weapon_id IN {$wp_dynamite})"; list($score, $playerid, $name, $players, $scores, $playerids, $flags) = CreateMedal($qry, "total_deaths", "total_deaths DESC", 2, ""); ShowMedal($text["mmdynamite"], $text["dynamitedeth"], $score, $playerid, $name, "xlr_shame_nade.png", $text["mostdyndeth"], $players, $scores, $fname, $playerids, $flags, $ch); } }
function shame_medal_careless() { $link = baselink(); global $coddb; global $separatorline; global $t; //table names global $a_name; //award names global $a_desc; //award descriptions global $w; global $minkills; global $minrounds; global $maxdays; global $wp_accidents; global $text; global $exclude_ban; $current_time = gmdate("U"); $query = " SELECT {$t['b3_clients']}.name, {$t['players']}.id, ip, {$t['b3_clients']}.time_edit, {$t['players']}.fixed_name, rounds, (SUM({$t['weaponusage']}.suicides) / {$t['players']}.rounds) AS total_suicides\n FROM {$t['weaponusage']}\n JOIN {$t['players']} ON {$t['weaponusage']}.player_id = {$t['players']}.id\n JOIN {$t['b3_clients']} ON {$t['players']}.client_id = {$t['b3_clients']}.id\n WHERE ({$t['weaponusage']}.weapon_id IN {$wp_accidents})\n AND (({$t['players']}.kills > {$minkills})\n OR ({$t['players']}.rounds > {$minrounds}))\n AND ({$t['players']}.hide = 0)\n AND ({$current_time} - {$t['b3_clients']}.time_edit < {$maxdays}*60*60*24)"; if ($exclude_ban) { $query .= " AND {$t['b3_clients']}.id NOT IN (\n SELECT distinct(target.id)\n FROM {$t['b3_penalties']} as penalties, {$t['b3_clients']} as target\n WHERE (penalties.type = 'Ban' OR penalties.type = 'TempBan')\n AND inactive = 0\n AND penalties.client_id = target.id\n AND ( penalties.time_expire = -1 OR penalties.time_expire > UNIX_TIMESTAMP(NOW()) )\n )"; } $query .= " GROUP BY {$t['players']}.id\n ORDER BY total_suicides DESC\n LIMIT 1 "; $result = $coddb->sql_query($query); $row = $coddb->sql_fetchrow($result); $name = $row['fixed_name'] ? $row['fixed_name'] : $row['name']; $score = sprintf("%.2f", $row['total_suicides']); $playerid = $row['id']; $query = str_replace("LIMIT 1", "LIMIT 0, 10", $query); $result = $coddb->sql_query($query); while ($row = $coddb->sql_fetchrow($result)) { $names = $row['fixed_name'] ? $row['fixed_name'] : $row['name']; $players[] = $names; $scores[] = sprintf("%.2f", $row['total_suicides']); $playerids[] = $row['id']; $flags[] = country_flag($row['ip']); } if (!isset($playerids, $flags, $players, $scores)) { $playerids = ""; $flags = ""; $players = ""; $scores = ""; } $fname = __FUNCTION__; ShowMedal($text["accidenthero"], $text["blindasbat"], $score, $playerid, $name, "xlr_shame_blind.png", $text["mostaccdeath"], $players, $scores, $fname, $playerids, $flags); }