• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Znote ACC mounts in shop

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,484
Solutions
9
Reaction score
217
How I can sell mounts in the shop using storage or something else than mount doll or addon doll ...
i'm using znote acc 1.5
 
You can set a new type on the mounts in config.php and then do a if statment in the shop script.
https://github.com/Znote/ZnoteAAC/blob/master/LUA/TFS_10/talkaction shopsystem/znoteshop.lua#L37

Config example with mount:
Code:
1 => array(
       'type' => 5,
       'mountid' => 19,
       'count' => 1,
       'description' => "Panda Mount",
       'points' => 120,
     ),

Example of shop.php
Code:
foreach ($shop_list as $key => $offers) {
        echo '<tr >';
        echo '<td>'. $offers['description'] .'</td>';
        if ($config['shop']['showImage']) {
            if ($offers['type'] == 5)
                echo '<td><img src="http://'. $config['shop']['imageServer'] .'/mounts/'. $offers['mountid'] .'.'. $config['shop']['imageType'] .'" alt="img"></td>';
            } else {
                echo '<td><img src="http://'. $config['shop']['imageServer'] .'/'. $offers['itemid'] .'.'. $config['shop']['imageType'] .'" alt="img"></td>';
            }
        }
    }
Mount images will be loaded from a folder named mounts on the image server, either change the address or create a local "imageServer", edit the link in config.php.

You also need to add this to shop.php:
Code:
} else if ($buy['type'] == 5) {
    mysql_insert("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `mountid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['mountid'] ."', '". $buy['count'] ."', '$time')");
    echo '<font color="green" size="4">Your order is ready to be delivered. Write this command in-game to get it [!shop].</font>';
}
Before this line:
https://github.com/Znote/ZnoteAAC/blob/master/shop.php#L54


TFS 1.X
You need to add a new row to the znote_shop_orders and name it mountid for example.
Then add mountid in the local orderQuery like this
Code:
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `mountid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. player:getAccountId() .. " LIMIT 1;")

Now you need to register a local to get the result of dataInt, like this:
Code:
local q_mountid = result.getDataInt(orderQuery, "mountid")

Example of a if statment in znoteshop.lua
Code:
if q_type == 5 then
    if player:hasMount(q_mountid) then
        player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already own this mount.")
    else
        db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
        player:addMount(q_mountid)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You bought a mount!")
    end
end


Untested but it should work.
 
Last edited:
local q_mountid = result.getDataInt(orderQuery, "mountid")
where I put it ?
also,
Code:
foreach ($shop_list as $key => $offers) {
echo '<tr >';
echo '<td>'. $offers['description'] .'</td>';
if ($config['shop']['showImage']) {
if ($offers['type'] == 5)
echo '<td><img src="http://'. $config['shop']['imageServer'] .'/mounts/'. $offers['mountid'] .'.'. $config['shop']['imageType'] .'" alt="img"></td>';
} else {
echo '<td><img src="http://'. $config['shop']['imageServer'] .'/'. $offers['itemid'] .'.'. $config['shop']['imageType'] .'" alt="img"></td>';
}
}
}
it is hard to understand, my shop.lua are like it:
Code:
foreach ($shop_list as $key => $offers) {
        echo '<tr class="special">';
        echo '<td>'. $offers['description'] .'</td>';
        if ($config['shop']['showImage']) echo '<td><img src="http://'. $config['shop']['imageServer'] .'/'. $offers['itemid'] .'.'. $config['shop']['imageType'] .'" 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  "  class="needconfirmation" data-item-name="<?php echo $offers['description']; ?>" data-item-cost="<?php echo $offers['points']; ?>">
        </form>
        <?php
        echo '</td>';
        echo '</tr>';
        }
 
Last edited:
Back
Top