Jump to content

RhysBennett

New Members
  • Posts

    4
  • Joined

  • Last visited

RhysBennett's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Could you give me an example? I wasn't throwing them both in the same script, I was calling them on the webpage as two different scripts as two different includes.
  2. If you use this script with different values, so include('scriptv1') include('scriptv2') Only the first will work but apparently using a foreach to house multiple connections into one script DOES work. I just don't know how to do that. Make more sense or am I being confusing? Edit: Here, the first script overrides the second (at the bottom of the page where it says rustoria) https://www.ketzen.com/games/cs-go
  3. If you use this script with different values, so include('scriptv1') include('scriptv2') Only the first will work but apparently using a foreach to house multiple connections into one script DOES work. I just don't know how to do that. Make more sense or am I being confusing?
  4. Hi, first post here. It's the first time I've been so stuck really. I'm using the library below to pull server data (players, time online etc) from a Steam game through the source API, however it will not work with more than one script or server at once. For example, if I copy the script into a new file and change the connection info, and include both in my HTML, only one will work. Any ideas on how to do it, or an example would be amazing. http://github.com/xPaw/PHP-Source-Query <?php namespace web2; require __DIR__ . '/SourceQuery/bootstrap.php'; use xpaw\SourceQuery\SourceQuery; // For the sake of this example Header( 'Content-Type: text/html' ); Header( 'X-Content-Type-Options: nosniff' ); // Edit this -> define( 'SQ_SERVER_ADDR', 'iphere' ); define( 'SQ_SERVER_PORT', 27015 ); define( 'SQ_TIMEOUT', 3 ); 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(); /*echo "<h1>Players: ".$info['Players' 'MaxPlayers']."</h1>"; echo "<h1>Max Players: ".$info['MaxPlayers']."<h1>"; */ var_dump($info); echo "<p>Hostname: ".$info['HostName']."</p>"; $players = $info['Players']; $maxplayers = $info['MaxPlayers']; echo "<p>Players: ".$players . " / " . $maxplayers."</p>"; echo "<p>Map: ".$info['Map']."</p>"; echo "<p>Port: ".$info['GamePort']."</p>"; echo "<p>Version: ".$info['Version']."</p>"; } catch( Exception $e ) { echo $e->getMessage( ); } finally { $Query->Disconnect( ); } ?> That's for one connection. It will not work with more, although you can do it, I've seen it done. Thank you in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.