Can someone provide simple code?

229 views
Skip to first unread message

mfor...@gmail.com

unread,
Oct 26, 2014, 4:44:09 PM10/26/14
to steam-c...@googlegroups.com
How I can get game master servers for e.g cs:go?
In wiki this code <?php
$master = new MasterServer(MasterServer::GOLDSRC_MASTER_SERVER);
$servers = $master->getServers();
$randomServer = $servers[array_rand($servers)];
$server = new GoldSrcServer($randomServer[0], $randomServer[1]);
?>
But what I need include first?
Thanks

Sebastian Staudt

unread,
Oct 28, 2014, 7:33:03 AM10/28/14
to steam-condenser
Hi.

First, CS:GO is not a GoldSrc game, you will have to use the following:

<?php 
$master = new MasterServer(MasterServer::SOURCE_MASTER_SERVER);
$servers = $master->getServers();
$randomServer = $servers[array_rand($servers)];
$server = new SourceServer($randomServer[0], $randomServer[1]);
?>

To require the correct files you could use Composer or you use the following snippet:

require_once './path/to/steam-condenser.php';

Have a look inside steam-condenser.php to see how to import other classes.

Best regards,
Sebastian 


--
You received this message because you are subscribed to the Google Groups "Steam Condenser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to steam-condens...@googlegroups.com.
To post to this group, send email to steam-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/steam-condenser/aa4672ab-c3d5-41e5-ac3b-af84a520496f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicholas Hastings

unread,
Oct 28, 2014, 7:49:24 AM10/28/14
to steam-c...@googlegroups.com
Both master server types return game servers for games of both engines. The GoldSrc masters also tend to be stable.

Sebastian Staudt

unread,
Oct 28, 2014, 8:30:40 AM10/28/14
to steam-condenser
Ok, this is probably true.
But the server class has to be the correct one for queries to work.

Reply all
Reply to author
Forward
0 new messages