Ir para conteúdo

[Encerrado] Bug Shop Gesior


walee

Posts Recomendados

Quando eu compro um item pelo shop, da esse erro e não para de vir items.

 

[11/07/2011 01:24:38] [Error - GlobalEvent Interface] 
[11/07/2011 01:24:38] data/globalevents/scripts/shop.lua:onThink
[11/07/2011 01:24:38] Description: 
[11/07/2011 01:24:38] data/globalevents/scripts/shop.lua:55: attempt to call field 'executeQuery' (a nil value)
[11/07/2011 01:24:38] stack traceback:
[11/07/2011 01:24:38] 	data/globalevents/scripts/shop.lua:55: in function <data/globalevents/scripts/shop.lua:4>
[11/07/2011 01:24:38] [Error - GlobalEvents::think] Couldn't execute event: shop

 

Alguem pode me ajudar? *--*

Link para o comentário
Compartilhar em outros sites

walee va na pasta do OT e em:

 

Data/globalevents/scripts

 

 

abra o shop.lua

 

 

aperte ctrl+h

 

e na parte de cima digite:

 

db.executeQuery

 

e na parte de baixo digite

 

db.query

 

e clica em localizar próxima ae quando localizar clique em substituir até não ter mais nada para substituir! e salve!

 

espero ter ajudo e se possivel rep +. hsuahsuash

Editado por ADM_Forever
Link para o comentário
Compartilhar em outros sites

poste seu shop.lua aqui! para eu ver

 

 

 

e poste seu globalevents.xml

 

tb to com o mesmo problema olha meu Shop.lua:

 

local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local 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
                       local id = tonumber(result_plr:getDataInt("id"))
                       local action = tostring(result_plr:getDataString("action"))
                       local delete = tonumber(result_plr:getDataInt("delete_it"))
                       local 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
                                       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)
                                               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)
                                               doItemSetAttribute(new_item, "description", "Item Vip do player > ".. getPlayerName(cid) .."!")
                                               doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
                                               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.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  

 

fica dando erro no db.qurey pra colocar um novo value...

Link para o comentário
Compartilhar em outros sites

poste seu shop.lua aqui! para eu ver

 

 

 

e poste seu globalevents.xml

 

tb to com o mesmo problema olha meu Shop.lua:

 

local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local 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
                       local id = tonumber(result_plr:getDataInt("id"))
                       local action = tostring(result_plr:getDataString("action"))
                       local delete = tonumber(result_plr:getDataInt("delete_it"))
                       local 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
                                       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)
                                               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)
                                               doItemSetAttribute(new_item, "description", "Item Vip do player > ".. getPlayerName(cid) .."!")
                                               doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
                                               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.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  

 

fica dando erro no db.qurey pra colocar um novo value...

 

 

use o que eu uso que não da erro nenhum:

 

local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local 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
                       local id = tonumber(result_plr:getDataInt("id"))
                       local action = tostring(result_plr:getDataString("action"))
                       local delete = tonumber(result_plr:getDataInt("delete_it"))
                       local 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
                                       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)
                                               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)
                                               doItemSetAttribute(new_item, "description", "This item can only be used by the player ".. getPlayerName(cid) .."!")
                                               doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
                                               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 .. ";")
                                       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

 

e também adicione isso a sua database:

 

CREATE TABLE IF NOT EXISTS `z_ots_comunication` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`action` varchar(255) NOT NULL,
`param1` varchar(255) NOT NULL,
`param2` varchar(255) NOT NULL,
`param3` varchar(255) NOT NULL,
`param4` varchar(255) NOT NULL,
`param5` varchar(255) NOT NULL,
`param6` varchar(255) NOT NULL,
`param7` varchar(255) NOT NULL,
`delete_it` int(2) NOT NULL default '1',
PRIMARY KEY (`id`)
);

 

 

CREATE TABLE IF NOT EXISTS `z_shop_offer` (
`id` int(11) NOT NULL auto_increment,
`points` int(11) NOT NULL default '0',
`itemid1` int(11) NOT NULL default '0',
`count1` int(11) NOT NULL default '0',
`itemid2` int(11) NOT NULL default '0',
`count2` int(11) NOT NULL default '0',
`offer_type` varchar(255) default NULL,
`offer_description` text NOT NULL,
`offer_name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
);

 

CREATE TABLE IF NOT EXISTS `z_shop_history_item` (
`id` int(11) NOT NULL auto_increment,
`to_name` varchar(255) NOT NULL default '0',
`to_account` int(11) NOT NULL default '0',
`from_nick` varchar(255) NOT NULL,
`from_account` int(11) NOT NULL default '0',
`price` int(11) NOT NULL default '0',
`offer_id` int(11) NOT NULL default '0',
`trans_state` varchar(255) NOT NULL,
`trans_start` int(11) NOT NULL default '0',
`trans_real` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);

 

CREATE TABLE IF NOT EXISTS `z_shop_history_pacc` (
`id` int(11) NOT NULL auto_increment,
`to_name` varchar(255) NOT NULL default '0',
`to_account` int(11) NOT NULL default '0',
`from_nick` varchar(255) NOT NULL,
`from_account` int(11) NOT NULL default '0',
`price` int(11) NOT NULL default '0',
`pacc_days` int(11) NOT NULL default '0',
`trans_state` varchar(255) NOT NULL,
`trans_start` int(11) NOT NULL default '0',
`trans_real` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);

 

e no globalevents.xml add isso:

 

<globalevent name="shop" interval="30" event="script" value="shop.lua"/>

Editado por ADM_Forever
Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
  • 6 months later...

Estou com o mesmo problema o meu esta assim

 

shop.lua

 

 

-- ### CONFIG ###

-- message send to player by script "type" (types you can check in "global.lua")

SHOP_MSG_TYPE = 19

-- time (in seconds) between connections to SQL 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

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 just got a >> '.. add_item_name ..' << from the Tibera-World Shop Offert. Please logout so your character can save.')

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

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

 

 

<globalevent name="shop" interval="30000" script="shop.lua"/>

Link para o comentário
Compartilhar em outros sites

  • 4 weeks later...

Gente seguinte eu quero ter shop gesior aquela tabela no shop com os items que player compra com poits para quando eu adiciono da certo mais quando vo na loja so aparece os meus poits QUERIA TIVESSE AQUELA TABELA COM OS ITEMS E TALS ME AJUDEM eu não tenho pasta item_imageen meus gesior é 0.3.7 queria ficasse igual essa imagen abaixo

 

http://imageshack.us.../403/shopo.png/

Editado por victorgod, Há um minuto.

Link para o comentário
Compartilhar em outros sites

  • 6 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...