From b6cb74d1a8d478208d085210be9941aca9efe4f4 Mon Sep 17 00:00:00 2001 From: xPaw Date: Tue, 22 Jul 2014 22:04:48 +0300 Subject: [PATCH] Rcon example --- Example.php | 2 +- RconExample.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 RconExample.php diff --git a/Example.php b/Example.php index 9a044d9..3d58c9c 100644 --- a/Example.php +++ b/Example.php @@ -5,7 +5,7 @@ Header( 'Content-Type: text/plain' ); // Edit this -> - define( 'SQ_SERVER_ADDR', 'gs2.my-run.de' ); + define( 'SQ_SERVER_ADDR', 'localhost' ); define( 'SQ_SERVER_PORT', 27015 ); define( 'SQ_TIMEOUT', 1 ); define( 'SQ_ENGINE', SourceQuery :: SOURCE ); diff --git a/RconExample.php b/RconExample.php new file mode 100644 index 0000000..f7b140c --- /dev/null +++ b/RconExample.php @@ -0,0 +1,29 @@ + + define( 'SQ_SERVER_ADDR', 'localhost' ); + define( 'SQ_SERVER_PORT', 27015 ); + define( 'SQ_TIMEOUT', 1 ); + define( 'SQ_ENGINE', SourceQuery :: SOURCE ); + // Edit this <- + + $Query = new SourceQuery( ); + + try + { + $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE ); + + $Query->SetRconPassword( 'my_awesome_password' ); + + var_dump( $Query->Rcon( 'say hello' ) ); + } + catch( Exception $e ) + { + echo $e->getMessage( ); + } + + $Query->Disconnect( );