Skip to content
This repository has been archived by the owner on Feb 2, 2018. It is now read-only.

piqus/bfp4f-rcon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfp4f-rcon

Battlefield Play4Free RCON Class developed by Ronny 'roennel' Gysin. Maintained by @piqus.

Installation

Install it via Composer

Add "piqus/bfp4f-rcon": "dev-master" into your composer.json dependencies.

{
  "require": {
    "piqus/bfp4f-rcon": "dev-master"
  }
}

then add link to your composer autoloader in php script:

/* Load Classes 
 ********************/
require_once __DIR__ . '/vendor/autoload.php';

Install via .ZIP

Download from https://github.com/piqus/bfp4f-rcon/archive/master.zip or click on "Download ZIP". Unpack. Add require each field by php require_once statement. Like:

// Autoload:
foreach (glob("src/T4G/BFP4F/Rcon/*.php") as $class)
{
    require_once $class;
}

or include as single file:

require_once "src/T4G/BFP4F/Rcon/Base.php";
require_once "src/T4G/BFP4F/Rcon/Players.php";
require_once "src/T4G/BFP4F/Rcon/Chat.php";
require_once "src/T4G/BFP4F/Rcon/Server.php";
require_once "src/T4G/BFP4F/Rcon/Support.php";
require_once "src/T4G/BFP4F/Rcon/Stats.php";

Use

Instantiate namespace and establish connection:

/* Instantiate rcon 
 ********************/
use T4G\BFP4F\Rcon as rcon;
$rc = new rcon\Base();

/* Connect to server 
 ********************/
$rc->ip = $server_ip;
$rc->port = $server_port;
$rc->pwd = $rcon_password;

$rc->connect($cn, $cs);

if ($cn !== 0) {
    $err = "E: Game server {$srv['srv_name']} 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();

Contribution

I'd apreciate any help to improve this project. Use git clone magic or e-mail/IM me with your changes or sign up on github then edit it online by pressing "Edit".

About

Battlefield Play4Free RCON Class developed by Ronny 'roennel' Gysin with some improvements

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages