• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Znote Buypoints

tommy91

Member
Joined
Oct 27, 2010
Messages
250
Reaction score
19
Location
Sweden
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.
// 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("SELECT account_id FROM players WHERE name='$char' LIMIT 1;");
data_dump($account, false, "fetching account id from players table");
$account = mysql_select_single("SELECT id, coins FROM accounts WHERE account_id='". $account['account_id'] ."';");
// $znote_account = mysql_select_single("SELECT id, points FROM znote_accounts WHERE account_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("UPDATE accounts SET coins='$coins' WHERE account_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("SELECT coins FROM accounts WHERE account_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("UPDATE accounts SET coins='$new_points' WHERE account_id='$cid'");

$data = mysql_select_single("SELECT coins FROM accounts WHERE account_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));
 
Back
Top