Does PHP-Source-Query-Class still work with Rust or?
4 replies, posted
Hi guys,
I'm desperate here. For 2 days straight i've been searching the web for a query script for PHP, to get server info from my dedicated Rust server, and i'm about to give up.
Therefore I really hope you can help me! :)
Most query script I find is almost more than 4 years old, but the most updated i've found, is xPaw's: [url]https://github.com/xPaw/PHP-Source-Query-Class/blob/master/View.php[/url].
Does this script still work with Rust and if so, how do I set it up properly? I have basic PHP knowledge, but I am not strong with OOP.
Some info about the server:
This is how my batch file looks like:
[CODE]RustDedicated.exe -batchmode +server.port 28015 +rcon.ip 192.168.1.138 +rcon.port 28016 +rcon.password "xxxxxxxx" +server.maxplayers 150 +server.hostname "Gamers Guild EU - Oxide - BetterLoot - InstaCraft - Gather x10" +server.seed 3583633 +server.worldsize 5000 +server.identity "Gamers Guild"[/CODE]
It's running the latest version of the server and Oxide.
Both port 28015 (server port) and port 28016 (rcon port) is open and accessible on 77.68.224.197 which is the server IP. I can connect to the server without problem.
My PHP script looks like this:
[CODE]<?php
require __DIR__ . '/classes/SourceQuery/SourceQuery/SourceQuery.class.php';
// Edit this ->
define( 'SQ_SERVER_ADDR', '77.68.224.197' );
define( 'SQ_SERVER_PORT', 28016 );
define( 'SQ_TIMEOUT', 2 );
define( 'SQ_ENGINE', SourceQuery :: SOURCE );
// Edit this <-
$Query = new SourceQuery( );
try
{
$Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE );
$Info = $Query->GetInfo( );
$Players = $Query->GetPlayers( );
$Rules = $Query->GetRules( );
}
catch( Exception $e )
{
echo $e->getMessage( );
}
$Query->Disconnect( );
echo '<pre>';
print_r($Query);
echo '</pre>';
echo '<pre>';
print_r($Players);
echo '</pre>';
?>[/CODE]
This outputs this:
[CODE]SourceQuery Object
(
[Rcon:SourceQuery:private] =>
[Buffer:SourceQuery:private] => SourceQueryBuffer Object
(
[Buffer:SourceQueryBuffer:private] =>
[Length:SourceQueryBuffer:private] => 0
[Position:SourceQueryBuffer:private] => 0
)
[Socket:SourceQuery:private] => SourceQuerySocket Object
(
[Socket] =>
[Engine] => 1
[Ip] => 77.68.224.197
[Port] => 28016
[Timeout] => 2
[Buffer:SourceQuerySocket:private] => SourceQueryBuffer Object
(
[Buffer:SourceQueryBuffer:private] =>
[Length:SourceQueryBuffer:private] => 0
[Position:SourceQueryBuffer:private] => 0
)
)
[Connected:SourceQuery:private] =>
[Challenge:SourceQuery:private] => 0
[UseOldGetChallengeMethod:SourceQuery:private] =>
)[/CODE]
(Source: [url]http://www.gamersguild.dk/test2.php[/url])
Can anyone see what the heck I might be doing wrong? :(
[QUOTE=Rocket;47864471]Rust does not run Source, so you cannot query it as a Source server.
[editline]2nd June 2015[/editline]
In theory, Rust supports RCON. In practice, [url=https://github.com/xPaw/PHP-Source-Query-Class/issues/20]it doesn't[/url].[/QUOTE]
Thanks, Rocket. I was getting this feeling as well, but I just couldn't believe it, since it looked like other people made it work.
I think i'll just have to wait and hope for them to implement some support for RCON :)
Thanks again!
snip nevermind
Quickly put together by changing some other scripts, still obviously a work in progress as it's useless in its current state, but future work will probably be closed source so figured I'd share. Went for a usleep instead of a blocking thread to allow some background work in the future.
[url]http://pastebin.com/JLUyawdE[/url]
Sources used for a small part of the implementation:
[url]http://pastebin.com/vQqmx6bR[/url] / [url]https://facepunch.com/showthread.php?t=1384264[/url]
[url]https://github.com/xPaw/PHP-Source-Query[/url]
Sorry, you need to Log In to post a reply to this thread.