public function cmdGetLoadout($cmdInfo)
 {
     $return = array('code' => 'ERROR', 'message' => '');
     if (!empty($cmdInfo['vars']) || $cmdInfo['vars'] != null) {
         if (!empty($cmdInfo['vars'])) {
             $result = $this->findPlayerByName($cmdInfo['vars']);
             if ($result['code'] == 'OK') {
                 $st = new T4G\BFP4F\Rcon\Stats($result['player']['nucleusId'], $result['player']['cdKeyHash']);
                 $it = new Itemlist($this->db, $this->config);
                 $itemList = $it->fetchItems();
                 $items = $itemList['items'];
                 $loadout = $st->retrieveLoadout();
                 $weapons = array();
                 $msg = '';
                 foreach ($loadout['data']['equipment'] as $key => $value) {
                     $weapons[] = $value['id'];
                 }
                 foreach ($weapons as $weaponId) {
                     $msg[] = $items[$weaponId]['item_name'];
                 }
                 $msg = implode(', ', $msg);
                 $msg = '|ccc| Loadout of ' . $result['player']['name'] . ': ' . $msg;
                 $this->ct->sendPlayer($cmdInfo['origin']['name'], $msg);
                 $return['code'] = 'OK';
             } else {
                 $return['message'] = $result['message'];
             }
         } else {
             $return['message'] = '|ccc| Please specify a player to get the loadout of';
         }
     } else {
         $return['message'] = '|ccc| Please specify a player to get the loadout of';
     }
     return $return;
 }
Example #2
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */
require_once '../../core/init.php';
use T4G\BFP4F\Rcon as rcon;
header('Content-type: application/json');
// Default response template
$response = array();
if ($user->checkLogin()) {
    if ($userInfo['rights_limiters'] == 'yes') {
        $it = new Itemlist($db, $config);
        $items = $it->fetchItems();
        if ($items['code'] == 'OK') {
            foreach ($items['items'] as $item) {
                if (!isset($_GET['weapons']) || isset($_GET['weapons']) && $item['item_category'] == 'weapon') {
                    $response[] = array('value' => $item['item_bf_id'], 'text' => $item['item_name']);
                }
            }
        } else {
            $response[] = getLang($items['message']);
        }
    } else {
        $response[] = $lang['msg_cmd_noaccess'];
    }
} else {
    $response[] = $lang['msg_nologin'];
}
Example #3
0
 $it = new Itemlist($db, $config);
 $bl = new Blacklist($db, $config);
 $wl = new WhiteList($db, $config);
 /**
  * LIMITERS
  *
  * NOTE: The blacklist comes first before the whitelist
  */
 /**
  * Fetch the players
  */
 $players = $pl->fetch();
 /**
  * Fetch the itemlist
  */
 $itemList = $it->fetchItems();
 $items = $itemList['items'];
 /**
  * Admins
  */
 $admins = array();
 /**
  * Count the classes and other stuff per team
  */
 $counter[1] = array('Assaults' => 0, 'Engineers' => 0, 'Medics' => 0, 'Recons' => 0, 'Shotguns' => 0);
 $counter[2] = array('Assaults' => 0, 'Engineers' => 0, 'Medics' => 0, 'Recons' => 0, 'Shotguns' => 0);
 foreach ($players as $player) {
     /**
      * Skip if the player is not connected yet
      * Or else the player will get stuck in the loadingscreen
      * Tip: be evil and disable this to troll them :P