Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Ola galera, o shop do meu server ta com um bug, acontece o seguinte, quando voce compra 1 item nao para de vir, vem vararios ! nao sei oque fazer , por favor me ajudem 

Grato.

Link para o post
Compartilhar em outros sites
  • Respostas 7
  • Created
  • Última resposta

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Posts

Talvez seja o data/globalevents/scripts/shop.lua adicione outro, a função dele é ler o que tem na tabela  z_ots_comunication onde fica armazenados os dados da compra do shopsite, após fazer a leitura executar a função apara adicionar o item no player e logo após remover da tabela z_ots_comunication a informação que foi executada. Se o problema for nele mesmo talvez ele não esteja executando a ultima função que é apagar os dados da tabela z_ots_comunication ai fica sempre enviando o item.

Talvez seja o data/globalevents/scripts/shop.lua adicione outro, a função dele é ler o que tem na tabela  z_ots_comunication onde fica armazenados os dados da compra do shopsite, após fazer a leitura executar a função apara adicionar o item no player e logo após remover da tabela z_ots_comunication a informação que foi executada.

Se o problema for nele mesmo talvez ele não esteja executando a ultima função que é apagar os dados da tabela z_ots_comunication ai fica sempre enviando o item.

Link para o post
Compartilhar em outros sites

Mude o arquivo shop.lua:

 

  1. local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
  2. local SQL_interval = 30
  3.  
  4. function onThink(interval, lastExecution)
  5.         local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
  6.         if(result_plr:getID() ~= -1) then
  7.                 while(true) do
  8.                         local id = tonumber(result_plr:getDataInt("id"))
  9.                         local action = tostring(result_plr:getDataString("action"))
  10.                         local delete = tonumber(result_plr:getDataInt("delete_it"))
  11.                         local cid = getPlayerByName(tostring(result_plr:getDataString("name")))
  12.                         if isPlayer(cid) then
  13.                                 local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
  14.                                 local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
  15.                                 local container_id = tonumber(result_plr:getDataInt("param3"))
  16.                                 local container_count = tonumber(result_plr:getDataInt("param4"))
  17.                                 local add_item_type = tostring(result_plr:getDataString("param5"))
  18.                                 local add_item_name = tostring(result_plr:getDataString("param6"))
  19.                                 local received_item = 0
  20.                                 local full_weight = 0
  21.                                 if add_item_type == 'container' then
  22.                                         container_weight = getItemWeightById(container_id, 1)
  23.                                         if isItemRune(itemtogive_id) == TRUE then
  24.                                                 items_weight = container_count * getItemWeightById(itemtogive_id, 1)
  25.                                         else
  26.                                                 items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
  27.                                         end
  28.                                         full_weight = items_weight + container_weight
  29.                                 else
  30.                                         full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
  31.                                         if isItemRune(itemtogive_id) == TRUE then
  32.                                                 full_weight = getItemWeightById(itemtogive_id, 1)
  33.                                         else
  34.                                                 full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
  35.                                         end
  36.                                 end
  37.                                 local free_cap = getPlayerFreeCap(cid)
  38.                                 if full_weight <= free_cap then
  39.                                         if add_item_type == 'container' then
  40.                                                 local new_container = doCreateItemEx(container_id, 1)
  41.                                                 local iter = 0
  42.                                                 while iter ~= container_count do
  43.                                                         doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
  44.                                                         iter = iter + 1
  45.                                                 end
  46.                                                 received_item = doPlayerAddItemEx(cid, new_container)
  47.                                         else
  48.                                                 local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
  49.                                                 doItemSetAttribute(new_item, "description", "This item can only be used by the player "..getPlayerName(cid) .."!")
  50.                                                 doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
  51.                                                 received_item = doPlayerAddItemEx(cid, new_item)
  52.                                         end
  53.                                         if received_item == RETURNVALUE_NOERROR then
  54.                                                 doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << RELOGUE PRA SALVAR URGENTE.')
  55.                                                 db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
  56.                                                 db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" ..os.time() .. " WHERE id = " .. id .. ";")
  57.                                         else
  58.                                                 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.')
  59.                                         end
  60.                                 else
  61.                                         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.')
  62.                                 end
  63.                         end
  64.                         if not(result_plr:next()) then
  65.                                 break
  66.                         end
  67.                 end
  68.                 result_plr:free()
  69.         end
  70.         return true
  71. end
Link para o post
Compartilhar em outros sites

Agora nao buga, mas o item nao eh enviado...

globalevents.xml  <globalevent name="shop" interval="30" script="shop.lua"/>>

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96847
    Tópicos
    519607
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo