• 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!

AAC ZnoteAac Shop

foulla

Member
Joined
Jun 26, 2016
Messages
78
Solutions
1
Reaction score
6
Hello otland
How can I make shop automatic and does not need to use !shop in ot
ZnoteAac
TFS 0.4
 
Solution
Lua:
local type_desc = {
    "itemids",
    "pending premium (skip)",
    "pending gender change (skip)",
    "pending character name change (skip)",
    "Outfit and addons",
    "Mounts",
    "Instant house purchase"
    }
            
function onThink(interval, lastExecution)
    if #getPlayersOnline() >= 1 then
        for i = 1,#getPlayersOnline() do
            local cid = getPlayersOnline()[i]
            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 .. ";")
            local served = false

            -- Detect if we...
post your !shop.lua code
!shop.lua

Lua:
-- Znote Shop v1.1 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))

        local type_desc = {
            "itemids",
            "pending premium (skip)",
            "pending gender change (skip)",
            "pending character name change (skip)",
            "Outfit and addons",
            "Mounts",
            "Instant house purchase"
        }
        print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
        -- Create the query
        local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. ";")
        local served = false

        -- Detect if we got any results
        if orderQuery ~= false then
            repeat
                -- 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")

                local description = "Unknown or custom type"
                if type_desc[q_type] ~= nil then
                    description = type_desc[q_type]
                end
                print("Processing type "..q_type..": ".. description)

                -- ORDER TYPE 1 (Regular item shop products)
                if q_type == 1 then
                    served = true
                    -- Get weight
                    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 received ".. 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
                -- ORDER TYPE 5 (Outfit and addon)
                if q_type == 5 then
                    served = true

                    local itemid = q_itemid
                    local outfits = {}

                    if itemid > 1000 then
                        local first = math.floor(itemid/1000)
                        table.insert(outfits, first)
                        itemid = itemid - (first * 1000)
                    end
                    table.insert(outfits, itemid)

                    for _, outfitId in pairs(outfits) do
                        -- Make sure player don't already have this outfit and addon
                        if not canPlayerWearOutfit(cid, outfitId, q_count) then
                            db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            doPlayerAddOutfit(cid,outfitId,q_count)
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
                        end
                    end
                end

                -- ORDER TYPE 6 (Mounts)
                if q_type == 6 then
                    served = true
                    -- Make sure player don't already have this outfit and addon
                    if not getPlayerMount(cid, q_itemid) then -- Failed to find a proper hasMount 0.3 function?
                        db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                        doPlayerAddMount(cid, q_itemid)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this mount!")
                    end
                end

                -- Add custom order types here
                -- Type 1 is for itemids (Already coded here)
                -- Type 2 is for premium (Coded on web)
                -- Type 3 is for gender change (Coded on web)
                -- Type 4 is for character name change (Coded on web)
                -- Type 5 is for character outfit and addon (Already coded here)
                -- Type 6 is for mounts (Already coded here)
                -- Type 7 is for Instant house purchase (Not for TFS 0.3)
                -- So use type 8+ for custom stuff, like etc packages.
                -- if q_type == 8 then
                -- end
            until not result.next(orderQuery)
            result.free(orderQuery)
            if not served then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders to process in-game.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "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
 
Last edited:
data/globalevents.xml (every 10 secs will run)
Lua:
<globalevent name="shop" interval="10" event="script" value="shop.lua"/>

data/globalevents/shop.lua
Lua:
function onThink(interval, lastExecution)
    if #getPlayersOnline() >= 1 then
        local type_desc = {
            "itemids",
            "pending premium (skip)",
            "pending gender change (skip)",
            "pending character name change (skip)",
            "Outfit and addons",
            "Mounts",
            "Instant house purchase"
            }
           
        for i = 1,#getPlayersOnline() do
            local cid = getPlayersOnline()[i]
            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 .. ";")
            local served = false

            -- Detect if we got any results
            if orderQuery ~= false then
                repeat
                    -- 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")

                    local description = "Unknown or custom type"
                    if type_desc[q_type] ~= nil then
                        description = type_desc[q_type]
                    end
                    print("Processing type "..q_type..": ".. description)

                    -- ORDER TYPE 1 (Regular item shop products)
                    if q_type == 1 then
                        served = true
                        -- Get weight
                        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 received ".. 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
                    -- ORDER TYPE 5 (Outfit and addon)
                    if q_type == 5 then
                        served = true

                        local itemid = q_itemid
                        local outfits = {}

                        if itemid > 1000 then
                            local first = math.floor(itemid/1000)
                            table.insert(outfits, first)
                            itemid = itemid - (first * 1000)
                        end
                        table.insert(outfits, itemid)

                        for _, outfitId in pairs(outfits) do
                            -- Make sure player don't already have this outfit and addon
                            if not canPlayerWearOutfit(cid, outfitId, q_count) then
                                db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                                doPlayerAddOutfit(cid,outfitId,q_count)
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
                            else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
                            end
                        end
                    end

                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not getPlayerMount(cid, q_itemid) then -- Failed to find a proper hasMount 0.3 function?
                            db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            doPlayerAddMount(cid, q_itemid)
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this mount!")
                        end
                    end

                    -- Add custom order types here
                    -- Type 1 is for itemids (Already coded here)
                    -- Type 2 is for premium (Coded on web)
                    -- Type 3 is for gender change (Coded on web)
                    -- Type 4 is for character name change (Coded on web)
                    -- Type 5 is for character outfit and addon (Already coded here)
                    -- Type 6 is for mounts (Already coded here)
                    -- Type 7 is for Instant house purchase (Not for TFS 0.3)
                    -- So use type 8+ for custom stuff, like etc packages.
                    -- if q_type == 8 then
                    -- end
                until not result.next(orderQuery)
                result.free(orderQuery)
                if not served then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders to process in-game.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders.")
            end
        end
    end
    return true
end
 
data/globalevents.xml (every 10 secs will run)
Lua:
<globalevent name="shop" interval="10" event="script" value="shop.lua"/>

data/globalevents/shop.lua
Lua:
function onThink(interval, lastExecution)
    if #getPlayersOnline() >= 1 then
        local type_desc = {
            "itemids",
            "pending premium (skip)",
            "pending gender change (skip)",
            "pending character name change (skip)",
            "Outfit and addons",
            "Mounts",
            "Instant house purchase"
            }
          
        for i = 1,#getPlayersOnline() do
            local cid = getPlayersOnline()[i]
            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 .. ";")
            local served = false

            -- Detect if we got any results
            if orderQuery ~= false then
                repeat
                    -- 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")

                    local description = "Unknown or custom type"
                    if type_desc[q_type] ~= nil then
                        description = type_desc[q_type]
                    end
                    print("Processing type "..q_type..": ".. description)

                    -- ORDER TYPE 1 (Regular item shop products)
                    if q_type == 1 then
                        served = true
                        -- Get weight
                        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 received ".. 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
                    -- ORDER TYPE 5 (Outfit and addon)
                    if q_type == 5 then
                        served = true

                        local itemid = q_itemid
                        local outfits = {}

                        if itemid > 1000 then
                            local first = math.floor(itemid/1000)
                            table.insert(outfits, first)
                            itemid = itemid - (first * 1000)
                        end
                        table.insert(outfits, itemid)

                        for _, outfitId in pairs(outfits) do
                            -- Make sure player don't already have this outfit and addon
                            if not canPlayerWearOutfit(cid, outfitId, q_count) then
                                db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                                doPlayerAddOutfit(cid,outfitId,q_count)
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
                            else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
                            end
                        end
                    end

                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not getPlayerMount(cid, q_itemid) then -- Failed to find a proper hasMount 0.3 function?
                            db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            doPlayerAddMount(cid, q_itemid)
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this mount!")
                        end
                    end

                    -- Add custom order types here
                    -- Type 1 is for itemids (Already coded here)
                    -- Type 2 is for premium (Coded on web)
                    -- Type 3 is for gender change (Coded on web)
                    -- Type 4 is for character name change (Coded on web)
                    -- Type 5 is for character outfit and addon (Already coded here)
                    -- Type 6 is for mounts (Already coded here)
                    -- Type 7 is for Instant house purchase (Not for TFS 0.3)
                    -- So use type 8+ for custom stuff, like etc packages.
                    -- if q_type == 8 then
                    -- end
                until not result.next(orderQuery)
                result.free(orderQuery)
                if not served then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders to process in-game.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders.")
            end
        end
    end
    return true
end
Done !!
what about this Img
https://otland.net/threads/znoteaac-highscores-img.274101/
Post automatically merged:

data/globalevents.xml (every 10 secs will run)
Lua:
<globalevent name="shop" interval="10" event="script" value="shop.lua"/>

data/globalevents/shop.lua
Lua:
function onThink(interval, lastExecution)
    if #getPlayersOnline() >= 1 then
        local type_desc = {
            "itemids",
            "pending premium (skip)",
            "pending gender change (skip)",
            "pending character name change (skip)",
            "Outfit and addons",
            "Mounts",
            "Instant house purchase"
            }
          
        for i = 1,#getPlayersOnline() do
            local cid = getPlayersOnline()[i]
            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 .. ";")
            local served = false

            -- Detect if we got any results
            if orderQuery ~= false then
                repeat
                    -- 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")

                    local description = "Unknown or custom type"
                    if type_desc[q_type] ~= nil then
                        description = type_desc[q_type]
                    end
                    print("Processing type "..q_type..": ".. description)

                    -- ORDER TYPE 1 (Regular item shop products)
                    if q_type == 1 then
                        served = true
                        -- Get weight
                        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 received ".. 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
                    -- ORDER TYPE 5 (Outfit and addon)
                    if q_type == 5 then
                        served = true

                        local itemid = q_itemid
                        local outfits = {}

                        if itemid > 1000 then
                            local first = math.floor(itemid/1000)
                            table.insert(outfits, first)
                            itemid = itemid - (first * 1000)
                        end
                        table.insert(outfits, itemid)

                        for _, outfitId in pairs(outfits) do
                            -- Make sure player don't already have this outfit and addon
                            if not canPlayerWearOutfit(cid, outfitId, q_count) then
                                db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                                doPlayerAddOutfit(cid,outfitId,q_count)
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
                            else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
                            end
                        end
                    end

                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not getPlayerMount(cid, q_itemid) then -- Failed to find a proper hasMount 0.3 function?
                            db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            doPlayerAddMount(cid, q_itemid)
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this mount!")
                        end
                    end

                    -- Add custom order types here
                    -- Type 1 is for itemids (Already coded here)
                    -- Type 2 is for premium (Coded on web)
                    -- Type 3 is for gender change (Coded on web)
                    -- Type 4 is for character name change (Coded on web)
                    -- Type 5 is for character outfit and addon (Already coded here)
                    -- Type 6 is for mounts (Already coded here)
                    -- Type 7 is for Instant house purchase (Not for TFS 0.3)
                    -- So use type 8+ for custom stuff, like etc packages.
                    -- if q_type == 8 then
                    -- end
                until not result.next(orderQuery)
                result.free(orderQuery)
                if not served then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders to process in-game.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have no orders.")
            end
        end
    end
    return true
end
have some problem
Code:
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
and this
and
These messages are continuous and do not disappear
Post automatically merged:

Done !!
what about this Img
https://otland.net/threads/znoteaac-highscores-img.274101/
Post automatically merged:


have some problem
Code:
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
Processing type 4: pending character name change (skip)
and this
and
These messages are continuous and do not disappear
and this to all player
Code:
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
20:25 You have no orders.
 
Last edited:
Lua:
local type_desc = {
    "itemids",
    "pending premium (skip)",
    "pending gender change (skip)",
    "pending character name change (skip)",
    "Outfit and addons",
    "Mounts",
    "Instant house purchase"
    }
            
function onThink(interval, lastExecution)
    if #getPlayersOnline() >= 1 then
        for i = 1,#getPlayersOnline() do
            local cid = getPlayersOnline()[i]
            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 .. ";")
            local served = false

            -- Detect if we got any results
            if orderQuery ~= false then
                repeat
                    -- 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")

                    local description = "Unknown or custom type"
                    if type_desc[q_type] ~= nil then
                        description = type_desc[q_type]
                    end

                    -- ORDER TYPE 1 (Regular item shop products)
                    if q_type == 1 then
                        served = true
                        -- Get weight
                        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 received ".. 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
                    -- ORDER TYPE 5 (Outfit and addon)
                    if q_type == 5 then
                        served = true

                        local itemid = q_itemid
                        local outfits = {}

                        if itemid > 1000 then
                            local first = math.floor(itemid/1000)
                            table.insert(outfits, first)
                            itemid = itemid - (first * 1000)
                        end
                        table.insert(outfits, itemid)

                        for _, outfitId in pairs(outfits) do
                            -- Make sure player don't already have this outfit and addon
                            if not canPlayerWearOutfit(cid, outfitId, q_count) then
                                db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                                doPlayerAddOutfit(cid,outfitId,q_count)
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
                            else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
                            end
                        end
                    end

                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not getPlayerMount(cid, q_itemid) then -- Failed to find a proper hasMount 0.3 function?
                            db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            doPlayerAddMount(cid, q_itemid)
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this mount!")
                        end
                    end

                    -- Add custom order types here
                    -- Type 1 is for itemids (Already coded here)
                    -- Type 2 is for premium (Coded on web)
                    -- Type 3 is for gender change (Coded on web)
                    -- Type 4 is for character name change (Coded on web)
                    -- Type 5 is for character outfit and addon (Already coded here)
                    -- Type 6 is for mounts (Already coded here)
                    -- Type 7 is for Instant house purchase (Not for TFS 0.3)
                    -- So use type 8+ for custom stuff, like etc packages.
                    -- if q_type == 8 then
                    -- end
                until not result.next(orderQuery)
                result.free(orderQuery)
            end
        end
    end
    return true
end
 
Solution
Lua:
local type_desc = {
    "itemids",
    "pending premium (skip)",
    "pending gender change (skip)",
    "pending character name change (skip)",
    "Outfit and addons",
    "Mounts",
    "Instant house purchase"
    }
           
function onThink(interval, lastExecution)
    if #getPlayersOnline() >= 1 then
        for i = 1,#getPlayersOnline() do
            local cid = getPlayersOnline()[i]
            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 .. ";")
            local served = false

            -- Detect if we got any results
            if orderQuery ~= false then
                repeat
                    -- 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")

                    local description = "Unknown or custom type"
                    if type_desc[q_type] ~= nil then
                        description = type_desc[q_type]
                    end

                    -- ORDER TYPE 1 (Regular item shop products)
                    if q_type == 1 then
                        served = true
                        -- Get weight
                        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 received ".. 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
                    -- ORDER TYPE 5 (Outfit and addon)
                    if q_type == 5 then
                        served = true

                        local itemid = q_itemid
                        local outfits = {}

                        if itemid > 1000 then
                            local first = math.floor(itemid/1000)
                            table.insert(outfits, first)
                            itemid = itemid - (first * 1000)
                        end
                        table.insert(outfits, itemid)

                        for _, outfitId in pairs(outfits) do
                            -- Make sure player don't already have this outfit and addon
                            if not canPlayerWearOutfit(cid, outfitId, q_count) then
                                db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                                doPlayerAddOutfit(cid,outfitId,q_count)
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
                            else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
                            end
                        end
                    end

                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not getPlayerMount(cid, q_itemid) then -- Failed to find a proper hasMount 0.3 function?
                            db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            doPlayerAddMount(cid, q_itemid)
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
                        else
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this mount!")
                        end
                    end

                    -- Add custom order types here
                    -- Type 1 is for itemids (Already coded here)
                    -- Type 2 is for premium (Coded on web)
                    -- Type 3 is for gender change (Coded on web)
                    -- Type 4 is for character name change (Coded on web)
                    -- Type 5 is for character outfit and addon (Already coded here)
                    -- Type 6 is for mounts (Already coded here)
                    -- Type 7 is for Instant house purchase (Not for TFS 0.3)
                    -- So use type 8+ for custom stuff, like etc packages.
                    -- if q_type == 8 then
                    -- end
                until not result.next(orderQuery)
                result.free(orderQuery)
            end
        end
    end
    return true
end
Solved !!
can u help me for this
https://otland.net/threads/znoteaac-highscores-img.274101/
 
Shop globalevent solve
Need img for highscores
Img not loading
config.php

PHP:
// Show outfits
    $config['show_outfits'] = array(
        'shop' => true,
        'highscores' => true,
        'characterprofile' => true,
        'onlinelist' => true,
        // Image server may be unreliable and only for test,
        // host yourself: https://otland.net/threads/item-images-10-92.242492/
        'imageServer' => 'https://outfit-images.ots.me/animatedOutfits1099/animoutfit.php'
    );

u need download all outfit or search some website that have this outfits, and change here:
PHP:
'imageServer' => 'https://outfit-images.ots.me/animatedOutfits1099/animoutfit.php'

and a link for u download all items/outfits, to host in your own computer:
Code:
https://otland.net/threads/item-images-10-92.242492/

if you want to disable showing the outfit, change everything to 'false'
 
config.php

PHP:
// Show outfits
    $config['show_outfits'] = array(
        'shop' => true,
        'highscores' => true,
        'characterprofile' => true,
        'onlinelist' => true,
        // Image server may be unreliable and only for test,
        // host yourself: https://otland.net/threads/item-images-10-92.242492/
        'imageServer' => 'https://outfit-images.ots.me/animatedOutfits1099/animoutfit.php'
    );

u need download all outfit or search some website that have this outfits, and change here:
PHP:
'imageServer' => 'https://outfit-images.ots.me/animatedOutfits1099/animoutfit.php'

and a link for u download all items/outfits, to host in your own computer:
Code:
https://otland.net/threads/item-images-10-92.242492/

if you want to disable showing the outfit, change everything to 'false'
I am using the latest version and it has all this added
 
My guess is that you didn't install the creaturescript file, because when I setting up Znote Account I had the exact problem.

It's one thing after the next with you it seems.
when Open image in new tab Opens ِAddons normally
Post automatically merged:


Post automatically merged:


i have two Question
1- and how hiden vocations <7 in support.php "support Team"
2- how hiden profile Onwer in characterprofile
if can help me in
 
My guess is that you didn't install the creaturescript file, because when I setting up Znote Account I had the exact problem.

It's one thing after the next with you it seems.
I have installed creaturescript in my database in creaturescripts.xml
 
Back
Top