• 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 talkaction in tfs 1.0 and donations doubt

peaverin

New Member
Joined
Mar 28, 2013
Messages
14
Reaction score
0
Hi all, I'm Peaverin.
I've just started to create my own server with the help of otland. I've already created one server that got more than 50 players online back in summer, but today i'm starting again with 10.31, and tfs 1.0 .
I've just set up my page with znote and a nice layout (Design by Naxtie@OtLand), and i managed to follow the simple tutorial to make the shop system work.
But then I realized that the script znoteshop.lua works only for tfs 0.3, so it just does nothing when i put it on my serv. Can someone modify this to make it work for tfs 1.0? I'd appreciate it, and if I have profit(when the server starts) i'll donate him a part of profit.
Here's the script:
This in talkactions:
Code:
<talkaction words="!shop" script="znoteshop.lua"/>
And this (znoteshop.lua) in talkactions/scripts:
Code:
-- 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 .. ";")
    
        -- 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 then
                        local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                        result.free(delete)
                        doPlayerAddItem(cid, q_itemid, q_count)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
                    else
                        doPlayerSendTextMessage(cid, 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
            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

Also wanted to know how to donate, because I tried with http://otland.net/payments.php , but that doesn't work. I won't donate a lot but maybe a part of the profit i got with the serv.

Thanks in advance, and please understand that im not from england, i'm from spain, so maybe i didn't explain 100% correctly.
 
Use this and you can donate here.
Sorry, but i already tried using the 0.2 one and it doesn't work, im using tfs 1.0
It just doesn't happen nothing when i use the command !shop (but i know i put it well because if i say it again before the 15 sec cooldown it says the message: 15:28 Can only be executed once every 15 seconds. Remaining cooldown: 12).
 
Mmm... maybe it's problem with my database...
My table znote_shop_orders looks like this:
4VyABDJ.png

Does your table looks like mine?
 
Ah, nvm, solved.
The script just works when the type is ==1, if it isn't it just does nothing (and the first order to be executed was the one with type 3 in the screen, that's why it wasn't happen anything).
Thanks for help!
 
Back
Top Bottom