2017 © Pedro PelĂĄez
 

library arma-rcon-class

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

image

nizarii/arma-rcon-class

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

  • Wednesday, January 10, 2018
  • by nizarii
  • Repository
  • 9 Watchers
  • 32 Stars
  • 1,986 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 14 Forks
  • 0 Open issues
  • 13 Versions
  • 1 % Grown

The README.md

Arma RCon Class (ARC) 2.2 for PHP

Codacy Badge Packagist Version GitHub License, (*1)

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

, (*2)

Requirements

ARC 2.2 only requires PHP 5.4 or higher!

, (*3)

Installation

If you haven't already, download Composer., (*4)

$ curl -s http://getcomposer.org/installer | php

Now require and install ARC., (*5)

$ composer require nizarii/arma-rcon-class
$ composer install

Without Composer

Choose a release and include ARC in your project: require_once 'arc.php';.

, (*6)

Examples

Getting started

After installing ARC, you can easily use ARC as shown below. It will automatically establish a new connection and authenticate., (*7)

use \Nizarii\ARC;

$rcon = new ARC(string $ServerIP, string $RConPassword [, int $Port = 2302 [, array $Options = array()]]);

You are able to send commands with the command() function., (*8)

//...
$rcon->command('YourCommand');

ARC will throw an Exception if anything goes wrong. You might want to wrap your code in a try catch block., (*9)

use \Nizarii\ARC;

try {
    $rcon = new ARC('127.0.0.1', 'password');

    $array = $rcon->getPlayersArray();

    $rcon
        ->sayGlobal('example')
        ->kickPlayer(1, 'example')
        ->sayPlayer(0, 'example')
        ->disconnect()
    ;

    $rcon->getBans(); // Throws exception, because the connection was closed
} catch (Exception $e) {
    echo "Ups! Something went wrong: {$e->getMessage()}";
}

Please consider that ARC only checks whether the command has been successfully sent via the socket to the server. It does not check if the command has been executed by the server.

, (*10)

Options

Options can be passed to ARC as an array via the fourth parameter of the constructor. The following options are currently available: * int timeoutSec = 1: Sets a timeout value on the connection. * bool autosavebans = false: Automatically saves bans.txt after a player is banned or unbanned. * bool debug = false : turns on debug mode, only works on "socketLoop()" and "socketLoopClose()", (*11)

Suggestions for new options are always welcome! :+1:
, (*12)

Basic usage:, (*13)

use \Nizarii\ARC;

$rcon = new ARC('127.0.0.1', 'RConPassword', 2322, [
    'timeoutSec' => 2
]);

//...

Functions

ARC features many functions to send BattlEye commands easier. After creating a new connections as explained above, you are able to use any of these functions: * string command(string $command): Sends any command to the BattlEye server. * string getPlayers(): Returns a list with all players, which are currently on the server. * array getPlayersArray(): Same as "getPlayers()", but formats the list to an array. * string getMissions(): Gets a list of the available missions on the server. * string getBans(): Gets a list of all BE server bans. * array getBansArray(): Gets an array of all bans. * object kickPlayer(int $player [, string $reason = 'Admin Kick']): Kicks a player who is currently on the server. * object sayGlobal(string $message): Sends a global message to all players. * object sayPlayer(int $player, string $message): Sends a message to a specific player. * object loadScripts(): Loads the "scripts.txt" file without the need to restart the server. * object maxPing(int $ping): Changes the MaxPing value. If a player has a higher ping, he will be kicked from the server. * object changePassword(string $password): Changes RCon password. * object loadBans(): (Re)loads the BE ban list from "bans.txt". * object banPlayer(string $player [, string $reason = 'Banned' [, int $time = 0]]): Ban a player's BE GUID from the server (If the time is 0, the ban will be permanent). * object addBan(string $player [, string $reason = 'Banned' [, int $time = 0]]): Same as "banPlayer()", but allows to ban a player that is not currently on the server. * object removeBan(int $banid): Removes a ban. * object writeBans(): Removes expired bans from the bans file. * object getBEServerVersion(): Gets the current version of the BE server. * disconnect(): Closes the current connection. * object reconnect(): Closes the current connection & creates a new one. * resource getSocket(): Get the socket, which is used by ARC to send commands to the server. * boolean socketLoop(int $loop = -1): Get constant socket stream. $loop is the number of loops to be run until exiting the method. Note that the sequence will be reset. Set to infinite looping by default. * boolean socketLoopClose(int $loop = -1): Similar as "socketLoop()", but disconnects after looping. Set to infinite looping by default. * array readPackageRaw(string $msg): Make BettlEye format package readable for your program. Use $msg with unreadable header and unmodified string. Array will start as [0] => "FF" when having correct header. Array value [1] has important information what kind of care it needs for your connection. For more information, click here., (*14)

See here for more information about BattlEye commands

, (*15)

Contributors

Thanks to all contributors for submitting issues and contributing code, including: * @nerdalertdk * @steffalon, (*16)

New contributors are always welcome :heart:

, (*17)

License

ARC is licensed under the MIT License. View LICENSE file for more information., (*18)

The Versions

10/01 2018

dev-master

9999999-dev https://github.com/Nizarii/arma-rcon-class-php/

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight client class rcon arma3 arma2 dayz battleye

09/01 2018

2.2

2.2.0.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight client class rcon arma3 arma2 dayz battleye

28/02 2017

dev-ARC-1.3

dev-ARC-1.3 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Felix SchÀfer

lightweight rcon arma3 arma2 dayz altislife operation arrowhead

28/02 2017

2.1.5

2.1.5.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC is a lightweight PHP class, that allows you connecting and sending commands easily to your BattlEye server, including Arma 3, Arma 2 and Arma 2: OA game servers.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight client class rcon arma3 arma2 dayz battleye

05/02 2017

1.3.7

1.3.7.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Felix SchÀfer

lightweight rcon arma3 arma2 dayz altislife operation arrowhead

28/01 2017

2.1.4

2.1.4.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily to your BattlEye server

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight client class rcon arma3 arma2 dayz battleye

02/08 2016

2.1.3

2.1.3.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily to your BattlEye server

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight client class rcon arma3 arma2 dayz battleye

21/06 2016

2.1.2

2.1.2.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily to your BattlEye server

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight client class rcon arma3 arma2 dayz battleye

03/06 2016

2.1.1

2.1.1.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight class rcon arma3 arma2 dayz altislife operation arrowhead

30/05 2016

1.3.6

1.3.6.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Felix SchÀfer

lightweight rcon arma3 arma2 dayz altislife operation arrowhead

23/05 2016

2.1

2.1.0.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Felix SchÀfer

lightweight class rcon arma3 arma2 dayz altislife operation arrowhead

20/05 2016

2.0.1

2.0.1.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Felix SchÀfer

lightweight class rcon arma3 arma2 dayz altislife operation arrowhead

11/05 2016

2.0

2.0.0.0 https://github.com/Nizarii/arma-rcon-class-php/

ARC allows you connecting and sending commands easily via RCon to your ARMA game server

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Felix SchÀfer

lightweight class rcon arma3 arma2 dayz altislife operation arrowhead