********************/ $rc->ip = $configs['general.server_ip']; $rc->port = (int) $configs['general.server_port']; $rc->pwd = $configs['general.server_password']; $rc->connect($cn, $cs); if ($cn !== 0) { $err = "E: Game server is not responding;" . PHP_EOL . "E: Invalid credentials or server is down;" . PHP_EOL . "E: {$cs} ({$cn})" . PHP_EOL; error_log($err); echo $err; exit(1); } $rc->init(); /* Retrieve data from game server ********************************/ // Create Player Object $rcp = new rcon\Players(); // Get Players Info $players = $rcp->fetch(); // Toolbox $sup = new rcon\Support(); /* DO NOT CHANGE! * Declare counters used to class and player limiter ***************************************************/ $classCounter[1] = array('assaults' => 0, 'engineers' => 0, 'medics' => 0, 'recons' => 0); $classCounter[2] = array('assaults' => 0, 'engineers' => 0, 'medics' => 0, 'recons' => 0); /* Run Limiter *************/ foreach ($players as $player) { /* Skip player which has loading screen **************************************/ if ($player->connected != '1') {
* 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('status' => 'ERROR', 'msg' => '', 'request_date' => date($settings['cp_date_format_full']), 'last_stream' => date($settings['cp_date_format_full'], $settings['server_last_stream']), 'info' => array(), 'players' => array(), 'chat' => array(), 'igaAdmins' => array()); if ($user->checkLogin()) { // Connect to server if (!$rc->connect($cn, $cs) || !$rc->init()) { $response['msg'] = $lang['msg_serverdown'] . ' ' . date($settings['cp_date_format_full'], $settings['server_last_stream']); } else { $cmg = new GameMaps(); $sv = new rcon\Server(); $pl = new rcon\Players(); $ct = new rcon\Chat(); if ($userInfo['rights_server'] == 'yes') { $response['status'] = 'OK'; $response['info'] = (array) $sv->fetch(); $response['info']['mapName'] = $cmg->getMapName($response['info']['map']); $response['info']['gameModeName'] = $cmg->getGameMode($response['info']['gameMode']); if (isset($_GET['players'])) { $response['players'] = $pl->fetch(); } if (isset($_GET['chat'])) { $response['chat'] = $ct->fetch(); } if (isset($_GET['igaAdmins'])) { $response['igaAdmins'] = $sv->fetchIgaAdmins(); }
$sv = new rcon\Server(); header('Content-type: application/json'); // Logs class $log = new Log($db, $config); // Whitelist class $wl = new Whitelist($db, $config); // Blacklist class $bl = new Blacklist($db, $config); // Accounts class $acc = new Accounts($db, $config); // Default response template $response = array('status' => 'ERROR', 'msg' => ''); if ($user->checkLogin()) { if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['cmd']) && isset($_POST['vars'])) { $sv = new rcon\Server(); $pl = new rcon\Players(); $ct = new rcon\Chat(); // Commands switch ($_POST['cmd']) { /** * Add a VIP */ case 'addVip': if (isset($_POST['vars']['name']) && isset($_POST['vars']['profileId'])) { if ($userInfo['rights_vips'] == 'yes') { // Connect to server $rc->connect($cn, $cs); $cn = $rc->init(); if ($cn) { $sv->setVip($_POST['vars']['name'], $_POST['vars']['profileId'], 1); $response['status'] = 'OK';
/** * RUN THIS SCRIPT WITH A CRONJOB! * RUN THIS SCRIPT WITH A CRONJOB! * 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(); /**