njitram
New Member
- Joined
- May 15, 2008
- Messages
- 14
- Reaction score
- 0
i hope some one has something on this:
sinds i kinda quited, and i had this one still on my desktop so here it is.
Make sure that the "$acc" is the ID of the player so it can look for that persons cash.
PHP:
<?php
function GetTotalCash($where, $itemid){
$ig = 0;
$ingetgold = mysql_query("SELECT * FROM $where WHERE player_id = '$acc' AND itemtype = $itemid");
while($inshowgold = mysql_fetch_array($ingetgold)){
$invgold[$ig] = $inshowgold[count];
$ig++;
}
return array_sum($invgold);
}
$totalinvenGold = GetTotalCash('player_items', 2148); // Gold player backpack
$totalinvenPlat = GetTotalCash('player_items', 2152); // Platinum player backpack
$totalinvenCrys = GetTotalCash('player_items', 2160); // Crystal player backpack
$totaldepotGold = GetTotalCash('player_depotitems', 2148); // Gold player depot
$totaldepotPlat = GetTotalCash('player_depotitems', 2152); // Platinum player depot
$totaldepotCrys = GetTotalCash('player_depotitems', 2160); // Crystal player depot
$totalGold = ($totalinvenGold+$totaldepotGold);
$totalPlat = (100*($totalinvenPlat+$totaldepotPlat));
$totalCrys = (10000*($totalinvenCrys+$totaldepotCrys));
$totalCashG = ($totalGold+$totalPlat+$totalCrys);
$totalCashP = (100/($totalGold+$totalPlat+$totalCrys));
$totalCashC = (10000/($totalGold+$totalPlat+$totalCrys));
echo "Gold = $totalCashG";
echo "Platinum = $totalCashP";
echo "Crystal = $totalCashC";
?>
sinds i kinda quited, and i had this one still on my desktop so here it is.
Make sure that the "$acc" is the ID of the player so it can look for that persons cash.