• 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 !shop command doesn't work.

willevarg

Experienced Tibia Player
Joined
Jan 24, 2011
Messages
30
Reaction score
0
Hello guys!

I have a problem I've been trying to fix for 4 hours straight now, I've come so far that when I write !shop it says in red text "You have no orders", although I have already ordered many donate items. I use tfs 0.4 and here is the code:

Lua:
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
function onSay(cid, words, param)
    local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
    local cooldown = 15 -- in seconds.

    if getPlayerStorageValue(cid, storage) <= os.time() then
        setPlayerStorageValue(cid, storage, os.time() + cooldown)
        local accid = getAccountNumberByPlayerName(getCreatureName(cid))
   
        -- Create the query
        local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. "+2 LIMIT 1;")
   
        -- Detect if we got any results
        if orderQuery ~= false then
            -- Fetch order values
            local q_id = result.getDataInt(orderQuery, "id")
            local q_type = result.getDataInt(orderQuery, "type")
            local q_itemid = result.getDataInt(orderQuery, "itemid")
            local q_count = result.getDataInt(orderQuery, "count")
            result.free(orderQuery)
            -- ORDER TYPE 1 (Regular item shop products)
            if q_type == 1 then
                -- Get wheight
                local playerCap = getPlayerFreeCap(cid)
                local itemweight = getItemWeightById(q_itemid, q_count)
                    if playerCap >= itemweight and getTileInfo(getCreaturePosition(cid)).protection then
                        --backpack check
                        local backpack = getPlayerSlotItem(cid, 3)
                        local gotItem = false
                        if(backpack and backpack.itemid > 0) then
                            local received = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, q_itemid,q_count)
                            if(received ~= false) then
                                db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
                                gotItem = true
                            end
                        end

                        if(not gotItem) then
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no available space in backpack to receive that item.")
                        end                    
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP and Need ProtectZone!")
                    end
            end
            -- Add custom order types here
            -- Type 2 is reserved for premium days and is handled on website, not needed here.
            -- Type 3 is reserved for character gender(sex) change and is handled on website as well.
            -- So use type 4+ for custom stuff, like etc packages.
            -- if q_type == 4 then
            -- end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
        end
   
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
    end
    return false
end

I would appreciate and be happy with any kind of help and support from anyone, even guidlines so I can maybe learn myself.
 
Last edited by a moderator:
Where's the problem? Myphp? Some lua files? I have no clue where to search even if i googled and read all Znote posts.
 
PHP:
$config['shop_offers'] = array(
        1 => array(
            'type' => 1,
            'itemid' => 8850, // item to get in-game
            'count' => 1, // Stack number (5x itemid)
            'description' => "Dragon Crossbow (Range:6, Atk +18)", // Description shown on website
            'points' => 240, // How many points this offer costs
        ),
        2 => array(
            'type' => 1,
            'itemid' => 7735,
            'count' => 1,
            'description' => "Wand of Moltera.
It can only be wielded properly by sorcerers and druids of level 8 or higher.",
            'points' => 250,
        ),
        3 => array(
            'type' => 2,
            'itemid' => 5785, // Item to display on page
            'count' => 30, // Days of premium account
            'description' => "VIP",
            'points' => 100,
        ),
        8 => array(
            'type' => 1,
            'itemid' => 7422,
            'count' => 1,
            'description' => "Doom Hammer (Atk:75, Def:25 +3)",
            'points' => 250,
        ),
        9 => array(
            'type' => 1,
            'itemid' => 8931,
            'count' => 1,
            'description' => "Dragon Slayer (Atk:75, Def:25 +3)",
            'points' => 250,
        ),
        10 => array(
            'type' => 1,
            'itemid' => 2390,
            'count' => 1,
            'description' => "Moltera longsword (Atk:75, Def:28)",
            'points' => 250,
        ),
                11 => array(
            'type' => 1,
            'itemid' => 2496,
            'count' => 1,
            'description' => "Horned helmet (Arm:11, club fighting +2, sword fighting +2, axe fighting +2, protection holy -4%, death +2%).
It can only be wielded properly by knights",
            'points' => 200,
        ),
                12 => array(
            'type' => 1,
            'itemid' => 9778,
            'count' => 1,
            'description' => "Yalahari mask (Arm:8, magic level +3 It can only be wielded properly by Druids/Sorcerers)",
            'points' => 200,
        ),
                13 => array(
            'type' => 1,
            'itemid' => 2506,
            'count' => 1,
            'description' => "Dragon helmet (Arm:10, distance fighting +4)
It can only be wielded properly by paladins of level 8 or higher",
            'points' => 200,
        ),
                14 => array(
            'type' => 1,
            'itemid' => 8888,
            'count' => 1,
            'description' => "Master archer's armor (Arm:15, distance fighting +3).
It can only be wielded properly by paladins of level 8 or higher.",
            'points' => 200,
        ),
                15 => array(
            'type' => 1,
            'itemid' => 9776,
            'count' => 1,
            'description' => "Yalahari armor (Arm:16, club fighting +3, sword fighting +3, axe fighting +3, protection death +3%).
It can only be wielded properly by knights of level 8 or higher",
            'points' => 200,
        ),
                16 => array(
            'type' => 1,
            'itemid' => 8890,
            'count' => 1,
            'description' => "Robe of the underworld (Arm:12, protection holy -5%, death +12%).
It can only be wielded properly by sorcerers of level 8 or higher.",
            'points' => 200,
        ),
                17 => array(
            'type' => 1,
            'itemid' => 2469,
            'count' => 1,
            'description' => "Dragon legs (Arm:10, club fighting +1, sword fighting +1, axe fighting +1, protection energy -10%, earth +5%).
It can only be wielded properly by knights.",
            'points' => 300,
        ),
                18 => array(
            'type' => 1,
            'itemid' => 3983,
            'count' => 1,
            'description' => "Hululu skirt (Arm:16, magic level +2, speed +15).
It can only be wielded properly by sorcerers and druids of level 6 or higher.",
            'points' => 300,
        ),
                19 => array(
            'type' => 1,
            'itemid' => 9777,
            'count' => 1,
            'description' => "Yalahari leg piece (Arm:8, distance fighting +3, protection death +5%).
It can only be wielded properly by paladins of level 8 or higher.",
            'points' => 300,
        ),
        20 => array(
            'type' => 1,
            'itemid' => 2644,
            'count' => 1,
            'description' => "King Boots (Arm:10, protection all +5%, speed +25, faster regeneration) that is brand-new.
It can only be wielded properly by sorcerers, druids, paladins and knights.",
            'points' => 750,
        ),
        21 => array(
            'type' => 1,
            'itemid' => 6391,
            'count' => 1,
            'description' => "Nightmare shield (Def:37, protection holy -8%, death +2%).
It can only be wielded properly by knights.",
            'points' => 500,
        ),
        22 => array(
            'type' => 1,
            'itemid' => 6433,
            'count' => 1,
            'description' => "Necromancer shield (Def:37, distance fighting +3, magic level +1, protection death +6%).
It can only be wielded properly by paladins of level 8 or higher.",
            'points' => 500,
        ),
        23 => array(
            'type' => 1,
            'itemid' => 8903,
            'count' => 1,
            'description' => "Spellbook of lost souls (Def:20, magic level +6).
It can only be wielded properly by sorcerers and druids of level 8 or higher.",
            'points' => 500,
        ),
                24 => array(
            'type' => 1,
            'itemid' => 8300,
            'count' => 1,
            'description' => "Ice crystal Upgrades your equipment or weapon with + stats. You get one of the following stats or skill upgraded with a % between 1% and 15%.  Example 1: +4% Magic level on legs. Example 2: +11% Sword fighting on your shield. ",
            'points' => 750,
        ),
                25 => array(
            'type' => 1,
            'itemid' => 7722,
            'count' => 1,
            'description' => "Full Stamina 1x",
            'points' => 50,
        ),
                26 => array(
            'type' => 1,
            'itemid' => 2229,
            'count' => 1,
            'description' => "Skull Remover 1x",
            'points' => 250,
        ),
                    27 => array(
            'type' => 1,
            'itemid' => 6529,
            'count' => 1,
            'description' => "Infernal Bolt",
            'points' => 10,
        ),
    );

How do i make it "interract with the homepage-server? Because the items already shown on the homepage and listed here in config.php still doesnt work, what am i missiing?
 
Last edited by a moderator:
PHP:
$config['shop_offers'] = array(
        1 => array(
            'type' => 1,
            'itemid' => 8850, // item to get in-game
            'count' => 1, // Stack number (5x itemid)
            'description' => "Dragon Crossbow (Range:6, Atk +18)", // Description shown on website
            'points' => 240, // How many points this offer costs
        ),
        2 => array(
            'type' => 1,
            'itemid' => 7735,
            'count' => 1,
            'description' => "Wand of Moltera.
It can only be wielded properly by sorcerers and druids of level 8 or higher.",
            'points' => 250,
        ),
        3 => array(
            'type' => 2,
            'itemid' => 5785, // Item to display on page
            'count' => 30, // Days of premium account
            'description' => "VIP",
            'points' => 100,
        ),
        8 => array(
            'type' => 1,
            'itemid' => 7422,
            'count' => 1,
            'description' => "Doom Hammer (Atk:75, Def:25 +3)",
            'points' => 250,
        ),
        9 => array(
            'type' => 1,
            'itemid' => 8931,
            'count' => 1,
            'description' => "Dragon Slayer (Atk:75, Def:25 +3)",
            'points' => 250,
        ),
        10 => array(
            'type' => 1,
            'itemid' => 2390,
            'count' => 1,
            'description' => "Moltera longsword (Atk:75, Def:28)",
            'points' => 250,
        ),
                11 => array(
            'type' => 1,
            'itemid' => 2496,
            'count' => 1,
            'description' => "Horned helmet (Arm:11, club fighting +2, sword fighting +2, axe fighting +2, protection holy -4%, death +2%).
It can only be wielded properly by knights",
            'points' => 200,
        ),
                12 => array(
            'type' => 1,
            'itemid' => 9778,
            'count' => 1,
            'description' => "Yalahari mask (Arm:8, magic level +3 It can only be wielded properly by Druids/Sorcerers)",
            'points' => 200,
        ),
                13 => array(
            'type' => 1,
            'itemid' => 2506,
            'count' => 1,
            'description' => "Dragon helmet (Arm:10, distance fighting +4)
It can only be wielded properly by paladins of level 8 or higher",
            'points' => 200,
        ),
                14 => array(
            'type' => 1,
            'itemid' => 8888,
            'count' => 1,
            'description' => "Master archer's armor (Arm:15, distance fighting +3).
It can only be wielded properly by paladins of level 8 or higher.",
            'points' => 200,
        ),
                15 => array(
            'type' => 1,
            'itemid' => 9776,
            'count' => 1,
            'description' => "Yalahari armor (Arm:16, club fighting +3, sword fighting +3, axe fighting +3, protection death +3%).
It can only be wielded properly by knights of level 8 or higher",
            'points' => 200,
        ),
                16 => array(
            'type' => 1,
            'itemid' => 8890,
            'count' => 1,
            'description' => "Robe of the underworld (Arm:12, protection holy -5%, death +12%).
It can only be wielded properly by sorcerers of level 8 or higher.",
            'points' => 200,
        ),
                17 => array(
            'type' => 1,
            'itemid' => 2469,
            'count' => 1,
            'description' => "Dragon legs (Arm:10, club fighting +1, sword fighting +1, axe fighting +1, protection energy -10%, earth +5%).
It can only be wielded properly by knights.",
            'points' => 300,
        ),
                18 => array(
            'type' => 1,
            'itemid' => 3983,
            'count' => 1,
            'description' => "Hululu skirt (Arm:16, magic level +2, speed +15).
It can only be wielded properly by sorcerers and druids of level 6 or higher.",
            'points' => 300,
        ),
                19 => array(
            'type' => 1,
            'itemid' => 9777,
            'count' => 1,
            'description' => "Yalahari leg piece (Arm:8, distance fighting +3, protection death +5%).
It can only be wielded properly by paladins of level 8 or higher.",
            'points' => 300,
        ),
        20 => array(
            'type' => 1,
            'itemid' => 2644,
            'count' => 1,
            'description' => "King Boots (Arm:10, protection all +5%, speed +25, faster regeneration) that is brand-new.
It can only be wielded properly by sorcerers, druids, paladins and knights.",
            'points' => 750,
        ),
        21 => array(
            'type' => 1,
            'itemid' => 6391,
            'count' => 1,
            'description' => "Nightmare shield (Def:37, protection holy -8%, death +2%).
It can only be wielded properly by knights.",
            'points' => 500,
        ),
        22 => array(
            'type' => 1,
            'itemid' => 6433,
            'count' => 1,
            'description' => "Necromancer shield (Def:37, distance fighting +3, magic level +1, protection death +6%).
It can only be wielded properly by paladins of level 8 or higher.",
            'points' => 500,
        ),
        23 => array(
            'type' => 1,
            'itemid' => 8903,
            'count' => 1,
            'description' => "Spellbook of lost souls (Def:20, magic level +6).
It can only be wielded properly by sorcerers and druids of level 8 or higher.",
            'points' => 500,
        ),
                24 => array(
            'type' => 1,
            'itemid' => 8300,
            'count' => 1,
            'description' => "Ice crystal Upgrades your equipment or weapon with + stats. You get one of the following stats or skill upgraded with a % between 1% and 15%.  Example 1: +4% Magic level on legs. Example 2: +11% Sword fighting on your shield. ",
            'points' => 750,
        ),
                25 => array(
            'type' => 1,
            'itemid' => 7722,
            'count' => 1,
            'description' => "Full Stamina 1x",
            'points' => 50,
        ),
                26 => array(
            'type' => 1,
            'itemid' => 2229,
            'count' => 1,
            'description' => "Skull Remover 1x",
            'points' => 250,
        ),
                    27 => array(
            'type' => 1,
            'itemid' => 6529,
            'count' => 1,
            'description' => "Infernal Bolt",
            'points' => 10,
        ),
    );

How do i make it "interract with the homepage-server? Because the items already shown on the homepage and listed here in config.php still doesnt work, what am i missiing?

Check in your database to see if you have anything in this table; znote_shop_orders
It might be that your website is older / newer and uses another table, not sure about the items loading, but might be the same way, if it loads from the database now or before, just what version your scripts are aswell as the website itself is.
 
Back
Top