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
 * This program is distributed in the hope that it will be useful,
 * 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
 * RUN THIS SCRIPT WITH A CRONJOB!
 * RUN THIS SCRIPT WITH A CRONJOB!
 * RUN THIS SCRIPT WITH A CRONJOB!
 * 
 * Run this script every 30 seconds is recommended.
 */
require_once dirname(dirname(__FILE__)) . '/core/init.php';
use T4G\BFP4F\Rcon as rcon;
if ($rc->connect($cn, $cs) && $rc->init()) {
    /**
     * Initialize the classes and stuff...
     */
    $pl = new rcon\Players();
    $ct = new rcon\Chat();
    $sv = new rcon\Server();
    $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();