Displaying Balance??
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Displaying Balance??
Okay i have been playing around with the api in which ever way i can figure out and im clue less.. im trying to display in my bank section on my site the balance of the current user logged in.. I have there bank balanca and the other is balance in game.. the balance in game which would be called via api.. how would i call this balance via api by itself.. any suggestions??
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Displaying Balance??
Call AccountsGet with "Player" set the player's name and look at "Balance" in the result. There's also a "RingChips" parameter returned if you want to see how many chips above that balance that they currently have in play.lildamien09 wrote:Okay i have been playing around with the api in which ever way i can figure out and im clue less.. im trying to display in my bank section on my site the balance of the current user logged in.. I have there bank balanca and the other is balance in game.. the balance in game which would be called via api.. how would i call this balance via api by itself.. any suggestions??
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Re: Displaying Balance??
well i know i can do that.. but i only want to display the balance by itself and not for me..its for the player who is logged into the bank on my site..so they can see there own balance and decide how much money they want to deposit into there savings account. (i.e call the balance via api.. and echo it with my php function to show it in there bank account info..)
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Re: Displaying Balance??
ill create a test account with the username test and the password testing so you can login and click bank link and see more or less what im trying to do..its pretty self explanitory when you look at the main bank page..
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Re: Displaying Balance??
i tried using the account get command to retrieve the balance of xuser and using php function bbalance=balance and echoing balance to page but i guess im doing something wrong as far as calling the balance using api commands.. if im able to call the balance alone using api in a php page, could you give me an example code of this action..
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Displaying Balance??
It's up to your code to just pull the balance out of the result and display it to you user. You normally wouldn't just echo the entire thing. And if this is outside of the game on your own web site, it's up to you to verify who the player is. Inside the game, they can just click the Account Balance button on the Login page of the Lobby (or on the Account menu).lildamien09 wrote:well i know i can do that.. but i only want to display the balance by itself and not for me..its for the player who is logged into the bank on my site..so they can see there own balance and decide how much money they want to deposit into there savings account. (i.e call the balance via api.. and echo it with my php function to show it in there bank account info..)
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Re: Displaying Balance??
well im not trying to echo the whole thing.. just the balance..yes its on my website..i would set $logged=Player in player and have it put the logged player name value for the api &player=$logged, but how would i call just the balance in my website. could you post an example api code possibly that i could work with and figure this out
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Displaying Balance??
Something like this (untested):lildamien09 wrote:i tried using the account get command to retrieve the balance of xuser and using php function bbalance=balance and echoing balance to page but i guess im doing something wrong as far as calling the balance using api commands.. if im able to call the balance alone using api in a php page, could you give me an example code of this action..
Code: Select all
include "API.php";
$player = "test";
$params = "Password=" . $pw . "&Command=AccountsGet&Player=" . $player;
$api = Poker_API($url,$params,true);
$result = $api["Result"];
if ($result == "Error") die("Error: " . $api["Error"]);
$balance = $api["Balance"];
echo "Current balance for " . $player . " is " . $balance;
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Re: Displaying Balance??
okay i will work with that and let you know the outcome of it.. thanks for the sample..
-
- Posts: 72
- Joined: Sun Sep 13, 2009 7:08 pm
- Location: TX
Re: Displaying Balance??
works perfect..modified it as followed
then echo'd it into my site for the ingame balance as follows
thanks for all the help at such a late hour bud.. heh, this is my peak time to work on my site without affecting users lol..
Code: Select all
$check = mysql_query("SELECT * FROM xbankx WHERE xusername = '$username'")or die(mysql_error());
include "API.php";
$player = "$username";
$params = "Password=" . $pw . "&Command=AccountsGet&Player=" . $player;
$api = Poker_API($url,$params,true);
$result = $api["Result"];
if ($result == "Error") die("Error: " . $api["Error"]);
$balance = $api["Balance"];
Code: Select all
<?php echo $balance; ?>