Request

For discussion of the Poker Mavens server module and other administration topics
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Request

Post by MonTheHoops »

Any chance of some more samples of pages with data pulled from the api? Like how many people are currently connected, what tournaments are available, who is currently winning the tournament? Stuff like that would be great to have shown on the site, it would encourage more people to play I would hope.

I would be looking long term to add each players stats from the Poker into their vBulletin profile page, that would be a great addition.

I have so far made a page the show the chipleaders, I just need more info of how they all work and maybe I can then start using chunks from each one to create a page with all the data I need on it.

Cheers Kent, and thanks for the great work.
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

MonTheHoops wrote:Like how many people are currently connected
<?php
include "API.php";
$params = "Password=" . $pw . "&Command=ConnectionsList";
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
echo "The number of connections is " . $api["Connections"];
?>
what tournaments are available
<?php
include "API.php";
$params = "Password=" . $pw . "&Command=TournamentsList&Fields=Name,BuyIn,Status";
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
$n = $api["Tournaments"];
echo "<b>Tournaments Available</b><br>";
for($i=1;$i<=$n;$i++) echo $api["Name".$i] . " - " . $api["BuyIn".$i] . " - " . $api["Status".$i] . "<br>";
?>
who is currently winning the tournament?
<?php
include "API.php";
$tname = "Tournament #1";
$params = "Password=" . $pw . "&Command=TournamentsPlaying&Name=" . urlencode($tname);
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
if (isset($api["Rank1"])) echo "Chip leader for " . $tname . " is " . $api["Player1"] . " (" . $api["Chips1"] . ")";
else echo $tname . " is not running";
?>
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

FYI, the contents of API.php are listed here:

http://www.briggsoft.com/forums/viewtop ... t=114#p563
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Request

Post by MonTheHoops »

Cheers Kent, I'm being greedy now, can this also list the current people connected by username?

Cheers.

:twisted:
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

MonTheHoops wrote:Cheers Kent, I'm being greedy now, can this also list the current people connected by username?
Just add a Fields=Player parameter to the ConnectionsList command as documented in the help file. Then loop through the results like was done with the tournament listing example and display $api["Player".$i]. You should check for blank values which indicate a connection made but the player not yet logged in. Something like this:

<?php
include "API.php";
$params = "Password=" . $pw . "&Command=ConnectionsList&Fields=Player";
$api = Poker_API($url,$params);
if ($api["Result"] == "Error") die("Error: " . $api["Error"]);
$n = $api["Connections"];
echo "<b>Players Logged In</b><br>";
$logins = 0;
for($i=1;$i<=$n;$i++) if($api["Player".$i] <> "")
{
echo $api["Player".$i] . "<br>";
$logins++;
}
echo "<b>Total: </b>" . $logins;
?>
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Request

Post by MonTheHoops »

That seems to throw up an error message of:

Error: SessionID not found

Did I miss something?
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Request

Post by MonTheHoops »

Ignore above, my fault.

I used ConnectionsGet instead of ConnectionsList

This is hard work, I'm no serious coder :D
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

MonTheHoops wrote:That seems to throw up an error message of:

Error: SessionID not found

Did I miss something?
Are you using ConnectionsGet instead of ConnectionsList?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Request

Post by Kent Briggs »

Your post beat me by 1 minute. :)
MonTheHoops
Posts: 48
Joined: Sat Jun 21, 2008 3:39 pm

Re: Request

Post by MonTheHoops »

Will the API allow access to the logfiles?

For instance is it capable of listing previous results in tournaments or ring games?

Can it show who has won the most tournaments?

Cheers Kent
Post Reply