dbjorkholm / FORGOTTENSERVER-ORTS

Try to make the perfect open real tibia server!
60 stars 76 forks source link

Shop #1245

Closed coney4 closed 10 years ago

coney4 commented 10 years ago

Hi pls help me when i update my ots today with your files my shop script stop work I think problem will be in this part

-- 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 .. " 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)

Lua Script Error: [TalkAction Interface] data/talkactions/scripts/znoteshop.lua:onSay data/talkactions/scripts/znoteshop.lua:8: attempt to call global 'getCreatureNam e' (a nil value) stack traceback: [C]: in function 'getCreatureName' data/talkactions/scripts/znoteshop.lua:8: in function <data/talkactions/ scripts/znoteshop.lua:2>

TheSumm commented 10 years ago

Your script is not using TFS 1.0 metatable functions. Readd the compat.lua changes if you want to stick with it.