I have a slight issue with the buypoints or shop script. When my players buy points in the Store ingame, the points end up in Znote_accounts instead of Accounts. What can i do? Here is my "changed" segment in the admin script.
1.
And this is the segment from the shop,
1.
// Give points to character
if (empty($_POST['points_char']) === false && empty($_POST['points_value']) === false) {
$char = sanitize($_POST['coins_char']);
$coins = (int)$_POST['coins_value'];
data_dump($_POST, false, "post data");
$account = mysql_select_single("SELECTaccount_id
FROMplayers
WHEREname
='$char' LIMIT 1;");
data_dump($account, false, "fetching account id from players table");
$account = mysql_select_single("SELECTid
,coins
FROMaccounts
WHEREaccount_id
='". $account['account_id'] ."';");
// $znote_account = mysql_select_single("SELECTid
,points
FROMznote_accounts
WHEREaccount_id
='". $account['account_id'] ."';");
data_dump($account, false, "Fetching existing points from accounts");
data_dump(
array(
'Old:' => $account['coins'],
'New:' => $coins,
'Total:' => ($account['coins'] + $coins)
),
false,
"Points calculation:");
$coins += $account['coins'];
mysql_update("UPDATEaccounts
SETcoins
='$coins' WHEREaccount_id
='". $account['account_id'] ."';");
}
And this is the segment from the shop,
// Verify that user can afford this offer.
if ($player_points >= $buy['coins']) {
$data = mysql_select_single("SELECTcoins
FROMaccounts
WHEREaccount_id
='$cid';");
if (!$data) die("0: Account is not converted to work with Znote AAC");
$old_points = $data['points'];
if ((int)$old_points != (int)$player_points) die("1: Failed to equalize your points.");
// Remove points if they can afford
// Give points to userz
$expense_points = $buy['coins'];
$new_points = $old_points - $expense_points;
$update_account = mysql_update("UPDATEaccounts
SETcoins
='$new_points' WHEREaccount_id
='$cid'");
$data = mysql_select_single("SELECTcoins
FROMaccounts
WHEREaccount_id
='$cid';");
$verify = $data['points'];
if ((int)$old_points == (int)$verify) die("2: Failed to equalize your points.". var_dump((int)$old_points, (int)$verify, $new_points, $expense_points));