• Steam Condenser Help
    6 replies, posted
Hi. I'm currently working on figuring out how to even start with [URL="https://github.com/koraktor/steam-condenser"]steam condenser.[/URL] I can do basic things like run commands on game servers, but like how would I find players that are on a server? I've done "$server->getPlayers()" but that just gives me a bunch of stuff that I don't need. I would like to take the players and put them all in a list, but it gives very little documentation and I just want a little help from someone who's used it before.
[QUOTE=Rocket;47797057]Remove the data from getPlayers that you don't need.[/QUOTE] Yea, I've established that I need to do that. So...how
[QUOTE=Rocket;47797068]I assume you want to get the names of all the players, so you can probably do: [code] $players = $server->getPlayers(); $playerNames = array(); foreach($players as $player) { $playerNames[] = $player->getName(); } [/code][/QUOTE] That does help me a bit more, thank you. Is there like a link or something that has better explanations of how to use steam condenser?
Ok so I'm trying to loop through players from servers in a database and create a table that lists the players for each one. I have 2 servers but I'm getting the players from server 1 on both tables. Here's my code: [CODE] $sql = "SELECT * FROM `servers`"; $rs = $connection->query($sql); if ($rs){ $server_players = "<table class='table table-condensed table-bordered table-hover'><tr><th>Player Name</th><th>Score</th></tr>"; while ($server = $rs->fetch_array(MYSQL_ASSOC)){ echo("<h2>". $server['Name'] ."</h2>"); $IP = $server['IP']; $Port = $server['Port']; $Rcon = $server['RCON']; $gameServer = new SourceServer($IP, $Port); $playersOnline = $gameServer->getPlayers(); foreach($playersOnline as $player){ $server_players .= "<tr><td>". $player->getName() ."</td><td>". $player->getScore() ."</td></tr>"; } $server_players .= "</table>"; echo $server_players; } } [/CODE][/CODE]
Sorry, you need to Log In to post a reply to this thread.