• 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 !shop command not working

Mister Budex

BudexOT.com
Joined
Jun 22, 2016
Messages
1,547
Solutions
18
Reaction score
378
Hello otlanders , i have an bug with ZnoteAAC tfs 0.3.6 !shop Command not works -.-
So when i buy an item from website 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!

So in game i say !shop , there is no reaction nothing...
data/talkactions/scripts/znoteshop.lua

Code:
-- Znote Shop v1.0 for Znote AAC on TFS 1.1
function onSay(player, words, param)
    local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
    local cooldown = 5 -- in seconds.

    if player:getStorageValue(storage) <= os.time() then
        player:setStorageValue(storage, os.time() + cooldown)

        -- Create the query
        local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. player:getAccountId() .. " LIMIT 1;")

        -- Detect if we got any results
        if orderQuery ~= false then
            -- Fetch order values
            local q_id = result.getNumber(orderQuery, "id")
            local q_type = result.getNumber(orderQuery, "type")
            local q_itemid = result.getNumber(orderQuery, "itemid")
            local q_count = result.getNumber(orderQuery, "count")
            result.free(orderQuery)

            -- ORDER TYPE 1 (Regular item shop products)
            if q_type == 1 then
                -- Get wheight
                if player:getFreeCapacity() >= ItemType(q_itemid):getWeight(q_count) then
                    db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                    player:addItem(q_itemid, q_count)
                    player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received " .. q_count .. " x " .. ItemType(q_itemid):getName() .. "!")
                else
                    player:sendTextMessage(MESSAGE_STATUS_WARNING, "Need more CAP!")
                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
            player:sendTextMessage(MESSAGE_STATUS_WARNING, "You have no orders.")
        end
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. player:getStorageValue(storage) - os.time())
    end
    return false
end


Okey , and in talkactions.xml is this
<talkaction words="!shop" event="script" value="znoteshop.lua" />
and error in my tfs 0.3.6
[27/01/2017 17:32:42] [Error - TalkAction Interface]
[27/01/2017 17:32:42] data/talkactions/scripts/znoteshop.lua:eek:nSay
[27/01/2017 17:32:42] Description:
[27/01/2017 17:32:42] data/talkactions/scripts/znoteshop.lua:6: attempt to index local 'player' (a number value)
[27/01/2017 17:32:42] stack traceback:
[27/01/2017 17:32:42] data/talkactions/scripts/znoteshop.lua:6: in function <data/talkactions/scripts/znoteshop.lua:2>
______________________________________________________________________Any help? Thanks

 
Last edited by a moderator:
Znote AAC offers up to three different script versions (0.2, 0.3, and tfs 1.0). Why didn't you pick the script that matches your server version?
did it right now , than i get this error
[27/01/2017 21:51:57] [Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/znoteshop.lua: No such file or directory
[27/01/2017 21:51:57] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/znoteshop.lua)
[27/01/2017 21:51:57] cannot open data/talkactions/scripts/znoteshop.lua: No such file or directory
 
Back
Top