예제 #1
0
 private function cmdStats(CommandSender $c, $args)
 {
     if (count($args) == 0) {
         if (!MPMU::inGame($c)) {
             return true;
         }
         $args = [$c->getName()];
     }
     foreach ($args as $pl) {
         if (MPMU::inGame($c, false) && $pl != $c->getName()) {
             if (!MPMU::access($c, "killrate.cmd.stats.other")) {
                 return true;
             }
         }
         $score = $this->dbm->getScores($pl);
         if ($score == null) {
             $c->sendMessage(mc::_("No scores found for %1%", $pl));
             continue;
         } else {
             if (count($args) != 1) {
                 $c->sendMessage(TextFormat::BLUE . $pl);
             }
             foreach ($score as $row) {
                 $c->sendMessage(TextFormat::GREEN . $row['type'] . ": " . TextFormat::WHITE . $row['count']);
             }
         }
     }
     return true;
 }
예제 #2
0
 private function cmdStats(CommandSender $c, $args)
 {
     if (count($args) == 0) {
         if (!MPMU::inGame($c)) {
             return true;
         }
         $args = [$c->getName()];
     }
     foreach ($args as $pl) {
         if (MPMU::inGame($c, false) && $pl != $c->getName()) {
             if (!MPMU::access($c, "killrate.cmd.stats.other")) {
                 return true;
             }
         }
         $score = $this->dbm->getScores($pl);
         if ($score == null) {
             $c->sendMessage(mc::_("No scores found for %1%", $pl));
             continue;
         } else {
             if (count($args) != 1) {
                 $c->sendMessage(TextFormat::BLUE . $pl);
             }
             list($k, $d) = [null, null];
             foreach ($score as $row) {
                 if ($row["type"] == "player") {
                     $k = (double) $row["count"];
                 }
                 if ($row["type"] == "deaths") {
                     $d = $row["count"];
                 }
                 $c->sendMessage(TextFormat::GREEN . $row['type'] . ": " . TextFormat::WHITE . $row['count']);
             }
             if ($k !== null && $d !== null && $d > 0) {
                 $c->sendMessage(TextFormat::GREEN . mc::_("kdratio: ") . TextFormat::WHITE . round($k / $d, 2));
             }
         }
     }
     return true;
 }