Skip to content

Commit b6cb74d

Browse files
committed
Rcon example
1 parent 5e84d9e commit b6cb74d

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

Example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Header( 'Content-Type: text/plain' );
66

77
// Edit this ->
8-
define( 'SQ_SERVER_ADDR', 'gs2.my-run.de' );
8+
define( 'SQ_SERVER_ADDR', 'localhost' );
99
define( 'SQ_SERVER_PORT', 27015 );
1010
define( 'SQ_TIMEOUT', 1 );
1111
define( 'SQ_ENGINE', SourceQuery :: SOURCE );

RconExample.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
3+
4+
// For the sake of this example
5+
Header( 'Content-Type: text/plain' );
6+
7+
// Edit this ->
8+
define( 'SQ_SERVER_ADDR', 'localhost' );
9+
define( 'SQ_SERVER_PORT', 27015 );
10+
define( 'SQ_TIMEOUT', 1 );
11+
define( 'SQ_ENGINE', SourceQuery :: SOURCE );
12+
// Edit this <-
13+
14+
$Query = new SourceQuery( );
15+
16+
try
17+
{
18+
$Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE );
19+
20+
$Query->SetRconPassword( 'my_awesome_password' );
21+
22+
var_dump( $Query->Rcon( 'say hello' ) );
23+
}
24+
catch( Exception $e )
25+
{
26+
echo $e->getMessage( );
27+
}
28+
29+
$Query->Disconnect( );

0 commit comments

Comments
 (0)