• 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 Issues with Geisor shop.

jimmydunphy

New Member
Joined
Aug 9, 2007
Messages
68
Reaction score
3
Location
Nova Scotia Canada
Hey guys/gals. I'm having a few issues with the Geisor shop (when I say a few, I really only mean one issue). I cannot get the item to send ingame.

I used this thread to set up my shop files: https://otland.net/threads/gesior2012-items-shop-installation-administration.170654/

Here is a copy of my relevant files, first GlobalXML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<globalevents>
    <globalevent name="website_shop_item_delivery" interval="30000" event="script" value="shop.lua"/>

    <!-- Wrath Of The Emperor Quest -->
    <globalevent name="WotESpyHoles" interval="5000" script="wrath of the emperor quest/spyHoles.lua" />

    <!-- Demon Oak Quest -->
    <globalevent name="DemonOakVoices" interval="15000" script="demon oak quest/voices.lua" />

    <!-- Rent Horses -->
    <globalevent name="RentedMounts" interval="15000" script="others/checkMount.lua" />

    <!-- Blooming Griffinclaw -->
    <globalevent name="GriffinclawFlower" type="startup" script="others/griffinclawFlower.lua" />

    <!-- World Changes -->
    <globalevent name="FuryGates" type="startup" script="worldchanges/furygates.lua" />
    <globalevent name="Yasir" type="startup" script="worldchanges/yasir.lua" />

    <!-- Others -->
    <globalevent type="startup" name="ServerStartup" script="startup.lua" />
    <globalevent type="record" name="PlayerRecord" script="record.lua" />
    <globalevent name="ServerSave" time="09:55:00" script="serversave.lua" />

    <!-- Spawn -->
    <globalevent name="RaidSystem" interval="10000" script="spawn/raids.lua" />
    <globalevent name="BossSystem" interval="3600000" script="spawn/BossSpawn.lua" />
    <globalevent type="startup" name="RashidSpawn" script="spawn/RashidSpawn.lua" />
    <globalevent type="startup" name="CilliaSpawn" script="spawn/CilliaSpawn.lua" />
</globalevents>


Now a copy of my Shop.lua
Code:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "data/lib/000-constants.lua")
SHOP_MSG_TYPE = MESSAGE_STATUS_CONSOLE_BLUE
-- time (in seconds) between queries to MySQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM `z_ots_comunication` WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
        while(true) do
            id = tonumber(result_plr:getDataInt("id"))
            action = tostring(result_plr:getDataString("action"))
            delete = tonumber(result_plr:getDataInt("delete_it"))
            cid = getCreatureByName(tostring(result_plr:getDataString("name")))
            if isPlayer(cid) == TRUE then
                local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
                local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
                local container_id = tonumber(result_plr:getDataInt("param3"))
                local container_count = tonumber(result_plr:getDataInt("param4"))
                local add_item_type = tostring(result_plr:getDataString("param5"))
                local add_item_name = tostring(result_plr:getDataString("param6"))
                local received_item = 0
                local full_weight = 0
                if add_item_type == 'container' then
                    container_weight = getItemWeightById(container_id, 1)
                    if isItemRune(itemtogive_id) == TRUE then
                        items_weight = container_count * getItemWeightById(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
                    if isItemRune(itemtogive_id) == TRUE then
                        full_weight = getItemWeightById(itemtogive_id, 1)
                    else
                        full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
                    end
                end
                local free_cap = getPlayerFreeCap(cid)
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = doCreateItemEx(container_id, 1)
                        doItemSetAttribute(new_container, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
                        doItemSetAttribute(new_container, "tid", id)
                        local iter = 0
                        while iter ~= container_count do
                            local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                            doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
                            doItemSetAttribute(new_item, "tid", id)
                            doAddContainerItemEx(new_container, new_item)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
                        doItemSetAttribute(new_item, "tid", id)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        doPlayerSave(cid)
                        db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return true
end
I would assume I've added a line of code in the wrong area? I can buy items in shop, but then in transaction history they say "not realized yet"

Thanks in advance!

here also is my talkactions file

Code:
<?xml version="1.0" encoding="UTF-8"?>
<talkactions>
    <talkaction log="yes" words="/addshop" access="5" event="script" value="add_shop_talkaction.lua"/>
  
    <!-- Gods -->
    <talkaction words="/addskill" separator=" " script="add_skill.lua" />
    <talkaction words="/chameleon" separator=" " script="chameleon.lua" />
    <talkaction words="/clean" script="clean.lua" />
    <talkaction words="/closeserver" separator=" " script="closeserver.lua" />
    <talkaction words="/i" separator=" " script="create_item.lua" />
    <talkaction words="/ghost" script="ghost.lua" />
    <talkaction words="/hide" script="hide.lua" />
    <talkaction words="/mccheck" script="mccheck.lua" />
    <talkaction words="/openserver" script="openserver.lua" />
    <talkaction words="/owner" separator=" " script="owner.lua" />
    <talkaction words="/m" separator=" " script="place_monster.lua" />
    <talkaction words="/s" separator=" " script="place_npc.lua" />
    <talkaction words="/summon" separator=" " script="place_summon.lua" />

    <!-- Achievements Commands -->
    <talkaction words="/addach" separator=" " script="achievements.lua" />
    <talkaction words="/removeach" separator=" " script="achievements.lua" />

    <!-- Gamemasters -->
    <talkaction words="/save" script="save.lua" />
    <talkaction words="/ban" separator=" " script="ban.lua" />
    <talkaction words="/ipban" separator=" " script="ipban.lua" />
    <talkaction words="/unban" separator=" " script="unban.lua" />
    <talkaction words="/up" script="up.lua" />
    <talkaction words="/down" script="down.lua" />
    <talkaction words="/c" separator=" " script="teleport_creature_here.lua" />
    <talkaction words="/goto" separator=" " script="teleport_to_creature.lua" />
    <talkaction words="/gotopos" separator=" " script="teleport_to_pos.lua" />
    <talkaction words="/t" script="teleport_home.lua" />
    <talkaction words="/town" separator=" " script="teleport_to_town.lua" />
    <talkaction words="/a" separator=" " script="teleport_ntiles.lua" />
    <talkaction words="/pos" separator=" " script="position.lua" />
    <talkaction words="/info" separator=" " script="info.lua" />
    <talkaction words="/r" separator=" " script="removething.lua" />
    <talkaction words="/kick" separator=" " script="kick.lua" />
    <talkaction words="/B" separator=" " script="broadcast.lua" />
    <talkaction words="/looktype" separator=" " script="looktype.lua" />
    <talkaction words="/mounts" separator=" " script="allmounts.lua" />
    <talkaction words="/addons" separator=" " script="alladdons.lua" />

    <!-- Senior Tutors -->
    <talkaction words="/addtutor" separator=" " script="add_tutor.lua" />
    <talkaction words="/removetutor" separator=" " script="remove_tutor.lua" />

    <!-- player talkactions -->
    <talkaction words="!buypremium" script="buyprem.lua" />
    <talkaction words="!buyhouse" script="buyhouse.lua" />
    <talkaction words="!leavehouse" script="leavehouse.lua" />
    <talkaction words="!changesex" script="changesex.lua" />
    <talkaction words="!uptime" script="uptime.lua" />
    <talkaction words="!deathlist" script="deathlist.lua" />
    <talkaction words="!kills" script="kills.lua" />
    <talkaction words="!online" script="online.lua" />
    <talkaction words="!serverinfo" script="serverinfo.lua" />
    <talkaction words="!addon" script="addon.lua" />

    <!-- test talkactions -->
    <talkaction words="!z" separator=" " script="magiceffect.lua" />
    <talkaction words="!x" separator=" " script="animationeffect.lua" />
</talkactions>
 
Last edited by a moderator:
Hello Narko! Thanks for the reply friend, I am using TFS 1.2 sorry for not mentioning that in my above post, I've also used that new link you suggested but still nothing, I've exhausted myself at this point lol

I also have this issue in my database in the z_shop_history section:
Edit Copy Delete 9 Rum And Coke 2 Anonymous 1 1 Umbral Master Crossbow wait 1451335432 0
Edit Copy Delete 10 Rum And Coke 2 Anonymous 1 1 Shield of Honour wait 1451335445 0

Note that the transaction state is listed as wait, while the transaction real is listed as 0.. I feel like theres something stopping this from happening ;/ anyone know?
 
Last edited by a moderator:
For people with same problem. Newest TFSes 1.x use other globalevents.xml format:
If you put OLD .xml code, it will not load script, but there will be no error in console!
Old code:
Code:
<globalevent name="website_shop_item_delivery" interval="30000" event="script" value="shop.lua"/>
TFS 1.x code:
Code:
<globalevent name="website_shop_item_delivery" interval="30000" script="shop.lua"/>
 
Back
Top