• 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!

Solved Adding Donate Points To Znote Acc

simson361

The Grim Reaper
Joined
Aug 4, 2010
Messages
626
Reaction score
27
Location
sweden
The Admin Panel On Znote Acc 1.4 dossent work to send points with is there any command i can add to make send points to charters like /addpoints 500, admin or fix the panel ? :/
i added point system to the server > 23:14 Congratulations! You have advanced to level 160 and you have earned 30 Premium Points! but i dident recive any points on website
Shop Offers
You have 0 points. (Buy points). :(((((((
You need more points, this offer cost 30 points.
 
Your LUA script need to give points to znote_accounts table

old: acconts->premium_points
new: znote_accounts->points
 
Your LUA script need to give points to znote_accounts table

old: acconts->premium_points
new: znote_accounts->points

can you tell me stop by step how to do it please its my first web and first time doing this stuff :) and rep+ if it still exist thx!! ^^
 
Post your point system :p

Code:
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';

// Import from config:
$shop = $config['shop'];
$shop_list = $config['shop_offers'];

if (!empty($_POST['buy'])) {
    $time = time();
    $player_points = (int)$user_znote_data['points'];
    $cid = (int)$user_data['id'];
    // Sanitizing post, setting default buy value
    $buy = false;
    $post = (int)$_POST['buy'];
  
    foreach ($shop_list as $key => $value) {
        if ($key === $post) {
            $buy = $value;
        }
    }
    if ($buy === false) die("Error: Shop offer ID mismatch.");
  
    // Verify that user can afford this offer.
    if ($player_points >= $buy['points']) {
        $old_points = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$cid';"), 0, 'points');
        if ((int)$old_points != (int)$player_points) die("1: Failed to equalize your points.");
        // Remove points if they can afford
        // Give points to user
        $expense_points = $buy['points'];
        $new_points = $old_points - $expense_points;
        $update_account = mysql_query("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$cid'");
      
        $verify = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$cid';"), 0, '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));
      
        // Do the magic (insert into db, or change sex etc)
        // If type is 2 or 3
        if ($buy['type'] == 2) {
            // Add premium days to account
            user_account_add_premdays($cid, $buy['count']);
            echo '<font color="green" size="4">You now have '.$buy['count'].' additional days of premium membership.</font>';
        } else if ($buy['type'] == 3) {
            // Character sex
            mysql_query("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '$time')") or die(mysql_error());
            echo '<font color="green" size="4">You now have access to change character gender on your characters. Visit <a href="myaccount.php">My Account</a> to select character and change the gender.</font>';
        } else {
            mysql_query("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '$time')") or die(mysql_error());
            echo '<font color="green" size="4">Your order is ready to be delivered. Write this command in-game to get it: [!shop].<br>Make sure you are in depot and can carry it before executing the command!</font>';
        }
      
        // No matter which type, we will always log it.
        mysql_query("INSERT INTO `znote_shop_logs` (`account_id`, `player_id`, `type`, `itemid`, `count`, `points`, `time`) VALUES ('$cid', '0', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '". $buy['points'] ."', '$time')") or die(mysql_error());
      
    } else echo '<font color="red" size="4">You need more points, this offer cost '.$buy['points'].' points.</font>';
    //var_dump($buy);
    //echo '<font color="red" size="4">'. $_POST['buy'] .'</font>';
}

if ($shop['enabled']) {
?>

<h1>Shop Offers</h1>
<?php
if (!empty($_POST['buy'])) {
    if ($user_znote_data['points'] >= $buy['points']) {
        ?><td>You have <?php echo (int)($user_znote_data['points'] - $buy['points']); ?> points. (<a href="buypoints.php">Buy points</a>).</td><?php
    } else {
        ?><td>You have <?php echo $user_znote_data['points']; ?> points. (<a href="buypoints.php">Buy points</a>).</td><?php
    }
} else {
    ?><td>You have <?php echo $user_znote_data['points']; ?> points. (<a href="buypoints.php">Buy points</a>).</td><?php
}
?>
<table id="shopTable">
    <tr class="yellow">
        <td>Describtion:</td>
        <?php if ($config['shop']['showImage']) { ?><td>Image:</td><?php } ?>
        <td>Count/duration:</td>
        <td>Points:</td>
        <td>Action:</td>
    </tr>
        <?php
        foreach ($shop_list as $key => $offers) {
        echo '<tr class="special">';
        echo '<td>'. $offers['describtion'] .'</td>';
        if ($config['shop']['showImage']) echo '<td><img src="http://'. $config['shop']['imageServer'] .'/'. $offers['itemid'] .'.gif" alt="img"></td>';
        if ($offers['type'] == 2) echo '<td>'. $offers['count'] .' Days</td>';
        else if ($offers['type'] == 3 && $offers['count'] == 0) echo '<td>Unlimited</td>';
        else echo '<td>'. $offers['count'] .'x</td>';
        echo '<td>'. $offers['points'] .'</td>';
        echo '<td>';
        ?>
        <form action="" method="POST">
            <input type="hidden" name="buy" value="<?php echo (int)$key; ?>">
            <input type="submit" value="  PURCHASE  ">
        </form>
        <?php
        echo '</td>';
        echo '</tr>';
        }
        ?>
</table>
<?php
} else echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
include 'layout/overall/footer.php'; ?>

--------------------
this is shop.php file plz make so the item sends to the buyer and that it works to add points with point system
 
i added point system to the server > 23:14 Congratulations! You have advanced to level 160 and you have earned 30 Premium Points! but i dident recive any points on website

I was hoping for this and not your buypoints.php :p
 
aha ok sorry xD
points.lua
Code:
local t, storage = {
    {160, 30},
    {190, 30},
    {220, 30},
    {250, 30},
    {280, 30},
    {300, 30},
    {315, 30},
    {330, 30}
}, 256

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill ~= SKILL__LEVEL then
        return true
    end
    for i = 1, #t do
        local v = t[i]
        if newLevel >= v[1] and getStorage(storage) < i then
            db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
            doSetStorage(storage, i)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
            doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')
            break
        end
    end
    return true
end
 
replace:
Code:
db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))

with:
Code:
db.executeQuery('UPDATE znote_accounts SET points=points+'.. v[2] ..' WHERE account_id=' .. getPlayerAccountId(cid))

Restart server and it should work with Znote AAC.

What about points I have in accounts.premium_points?
If you are transitioning the database from Gesior or Modern, you need to convert old accounts first.
Then you can transfer the points from accounts.premium_points to znote_accounts.points
https://github.com/Znote/ZnoteAAC/tree/master/special
Your Znote AAC should have a /special/ folder, which only give access to 127.0.0.1.

So visit http://127.0.0.1/special/
to access this folder.
Click on the database2znoteaac.php
to start converting old accounts to work with Znote AAC.

Then click on convertoldshoppoints.php
to move old points aquired over to Znote AAC, so they are usable in Znote AAC.

If you are missing any of the above files, download them from the github link I provided. This is the new "Znote AAC private svn". But now its public and on github. :)
 
Last edited:
@Znote there are a problem the items wont send to the in game character instand it says
Your order is ready to be delivered. Write this command in-game to get it: [!shop].
Make sure you are in depot and can carry it before executing the command!
but that command dossent even exist and i want it to send directly to the character (do you know how to fix it please? <3)
 
@simson361 In Znote AAC there is a LUA folder, inside there you can find TFS 0.2 and 0.3 scripts for the talkaction. Add it.
 
Back
Top