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

Erro shopsystem.php Dragon Ball 8.60

cmcpro

New Member
Joined
May 27, 2009
Messages
55
Reaction score
0
Location
Brazil/SP
Hi everyone, I have the following error in my dragon ball server 8.6, when I buy item in the vocation tab or, of utilitarios it does not arrive in the char and it appears these errors ai from below that is the page shopsystem.php that I use and the Shop.xml from the server, someone can help me I'm breaking my head a few days ago ... Thank you in advance. Remembering used geisor


globalevents/shop.php


Lua:
SHOP_MSG_TYPE = 19

SQL_interval = 30

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
                   full_weight = getItemWeightById(itemtogive_id, 1)
               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)
                       local iter = 0
                       while iter ~= container_count do
                           doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                           iter = iter + 1
                       end
                       received_item = doPlayerAddItemEx(cid, new_container)
                   else
                       local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                       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.')
                       db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                       db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
doPlayerSave(cid)
else
                       doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                   end
               else
                       doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
               end
           end
           if not(result_plr:next()) then
               break
           end
       end
       result_plr:free()
   end
   return TRUE
end

shopsystem.php

Lua:
[/COLOR]
[COLOR=#000000]SHOP_MSG_TYPE = 19[/COLOR]
[COLOR=#ff0000]
SQL_interval = 30

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
                   full_weight = getItemWeightById(itemtogive_id, 1)
               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)
                       local iter = 0
                       while iter ~= container_count do
                           doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                           iter = iter + 1
                       end
                       received_item = doPlayerAddItemEx(cid, new_container)
                   else
                       local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                       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.')
                       db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                       db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
doPlayerSave(cid)
else
                       doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                   end
               else
                       doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
               end
           end
           if not(result_plr:next()) then
               break
           end
       end
       result_plr:free()
   end
   return TRUE
end
 
Last edited by a moderator:
Solution
Problem was that he had configured the shop to send out container itemids insted, so the itemid was 0.
If someone were to run into this issue again, print out the container itemid and itemid to see if you messed up the param's in your database when inserting the shop items.
Upload your luascript.cpp so we can see what the function returns, since the script is expecting a return value your function might return a boolean value (true or false), causing the script to fail.
Or do as I said and try another one, there are plenty of these threads if you serach.

Where can I find this luascript.cpp? Which directory
luascript.cpp

These are the sources, you can send me a tfs. Compiled without errors I do not know anything about dev-cpp can help me?
Source DboRox.rar
 
Last edited:
Lua:
SHOP_MSG_TYPE = 19
SQL_interval = 30

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) 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
                    full_weight = getItemWeightById(itemtogive_id, 1)
                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)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        print("new_item", new_item, type(new_item))
                        received_item = doPlayerAddItemEx(cid, new_item)
                        print("received_item", received_item, type(received_item))
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                        doPlayerSave(cid)
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return true
end

Try that and take an SS of your console again.
 
Lua:
SHOP_MSG_TYPE = 19
SQL_interval = 30

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) 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
                    full_weight = getItemWeightById(itemtogive_id, 1)
                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)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        print("new_item", new_item, type(new_item))
                        received_item = doPlayerAddItemEx(cid, new_item)
                        print("received_item", received_item, type(received_item))
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                        doPlayerSave(cid)
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return true
end

Try that and take an SS of your console again.

Take a look, these are the fonts I'm using on my server, I do not know it would help ....
sources.rar
 

Attachments

Take a look, these are the fonts I'm using on my server, I do not know it would help ....
sources.rar

Try this;
Lua:
SHOP_MSG_TYPE = 19
SQL_interval = 30

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) 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
                    full_weight = getItemWeightById(itemtogive_id, 1)
                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)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        print("new_item", new_item, type(new_item))
                        received_item = doPlayerAddItemEx(cid, new_item)
                        print("received_item", received_item, type(received_item))
                    end
                    if received_item then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                        doPlayerSave(cid)
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return true
end
 
Try this;
Lua:
SHOP_MSG_TYPE = 19
SQL_interval = 30

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) 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
                    full_weight = getItemWeightById(itemtogive_id, 1)
                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)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        print("new_item", new_item, type(new_item))
                        received_item = doPlayerAddItemEx(cid, new_item)
                        print("received_item", received_item, type(received_item))
                    end
                    if received_item then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                        doPlayerSave(cid)
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return true
end

I put it, see the print below.
 

Attachments

Could you try another TFS version, seems like doCreateItemEx is bugged, since doPlayerAddItem(..) isn't giving the item.

Or install teamviewer and pm me the info.
 
Problem was that he had configured the shop to send out container itemids insted, so the itemid was 0.
If someone were to run into this issue again, print out the container itemid and itemid to see if you messed up the param's in your database when inserting the shop items.
 
Solution
Problem was that he had configured the shop to send out container itemids insted, so the itemid was 0.
If someone were to run into this issue again, print out the container itemid and itemid to see if you messed up the param's in your database when inserting the shop items.

Many thanks, WibbenZ problem sorted out :):)
 
Back
Top