Ir para conteúdo
  • Cadastre-se

Normal Item não chega ao jogador - Gesior ACC


Posts Recomendados

Boa tarde Tibianos!

 

Ultimamente tenho desenvolvido um servidor, e tenho usado como base para meu projeto o Vanaheim 10.90 e o GesiorACC criado pelo MITSUG, porém há um problema.

 

Ao jogador adquirir os Points para comprar items na loja, suponhamos que tenho 100 pontos, e vou comprar um item.. O Jogador compra mas simplesmente, ao relogar no char/account o item que foi comprado na Web Shop não chegou in-game.

 

Provavelmente é algum script que está faltando, poderiam me ajudar?

 

Grato dês de já! :D

Link para o post
Compartilhar em outros sites

Então localiza seu arquivo shop em  globalevents e troque por esse, e veja se da boa.

 

Spoiler

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- 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.storeQuery("SELECT * FROM z_ots_comunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local received_item = 0
                local full_weight = 0
				
				-- Script para addons e montaria full pelo Gesior -- 
				if(add_item_type == 'mounts') then
				local player = Player(cid)
				if (getPlayerStorageValue(cid,itemtogive_id) == -1) then
				doPlayerAddMount(cid, itemtogive_id)
				setPlayerStorageValue(cid,itemtogive_id,1)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Th3 Insanity 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,25,"You Already have this Mount.")
				end
				return TRUE
				
				end				
				-- fim do script --
				-- Script para addons e montaria full pelo Gesior -- 
				if(add_item_type == 'addons') then
				local player = Player(cid)
				if (getPlayerStorageValue(cid,itemtogive_id) == -1) then
				doPlayerAddOutfit(cid, itemtogive_id, 3) 
				doPlayerAddOutfit(cid, container_id, 3)
				setPlayerStorageValue(cid,itemtogive_id,1)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Th3 Insanity 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,25,"You Already have this Outfit.")
				end
				return TRUE
				end				
				-- fim do script --
				
				
				
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(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)
                        received_item = doPlayerAddItemEx(cid, new_item)
		
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Th3 Insanity 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 Th3 Insanity 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 ..' Th3 Insanity 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
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end

 

Link para o post
Compartilhar em outros sites
44 minutes ago, sirarcken said:

Então localiza seu arquivo shop em  globalevents e troque por esse, e veja se da boa.

 

  Hide contents


-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- 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.storeQuery("SELECT * FROM z_ots_comunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local received_item = 0
                local full_weight = 0
				
				-- Script para addons e montaria full pelo Gesior -- 
				if(add_item_type == 'mounts') then
				local player = Player(cid)
				if (getPlayerStorageValue(cid,itemtogive_id) == -1) then
				doPlayerAddMount(cid, itemtogive_id)
				setPlayerStorageValue(cid,itemtogive_id,1)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Th3 Insanity 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,25,"You Already have this Mount.")
				end
				return TRUE
				
				end				
				-- fim do script --
				-- Script para addons e montaria full pelo Gesior -- 
				if(add_item_type == 'addons') then
				local player = Player(cid)
				if (getPlayerStorageValue(cid,itemtogive_id) == -1) then
				doPlayerAddOutfit(cid, itemtogive_id, 3) 
				doPlayerAddOutfit(cid, container_id, 3)
				setPlayerStorageValue(cid,itemtogive_id,1)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Th3 Insanity 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,25,"You Already have this Outfit.")
				end
				return TRUE
				end				
				-- fim do script --
				
				
				
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(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)
                        received_item = doPlayerAddItemEx(cid, new_item)
		
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Th3 Insanity 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 Th3 Insanity 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 ..' Th3 Insanity 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
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end

 

Acabei de ver aqui, eu tinha visto esse script em outro servidor, porém era pra estar funcionando, só que eu tenho 2 backup's e coloquei em um que não está funcionando, fui notar isso agora e deu certo..

 

Obrigado amigo! :D

 

Reputado!

Link para o post
Compartilhar em outros sites
  • 3 years later...

Boa Tarde, alguem poderia me ajudar o meu sempre dá esse erro:

 

Lua Script Error: [GlobalEvent Interface] 
data/globalevents/scripts/shop.lua:onThink
data/globalevents/scripts/shop.lua:11: attempt to call field 'getDataInt' (a nil value)
stack traceback:
    [C]: in function 'getDataInt'
    data/globalevents/scripts/shop.lua:11: in function 
[Error - GlobalEvents::think] Failed to execute event: shop
Xplosion has logged in.

Lua Script Error: [GlobalEvent Interface] 
data/globalevents/scripts/shop.lua:onThink
data/globalevents/scripts/shop.lua:11: attempt to call field 'getDataInt' (a nil value)
stack traceback:
    [C]: in function 'getDataInt'
    data/globalevents/scripts/shop.lua:11: in function 
[Error - GlobalEvents::think] Failed to execute event: shop

 

 

Agradeço desde já.

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.


  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Imperius
      Olá, pessoal! Acabei encontrando um script que tinha feito a um tempo atrás. Estou compartilhando aqui para quem quiser usar ou melhorar.
       
      É bem parecido com os outros sistemas de roleta, igual deste tópico: https://tibiaking.com/forums/topic/101557-action-cassino-roleta-de-items/
       
      Como funciona?
       
      O "Treasure Chest" é um item custom, onde o jogador têm a possibilidade de ganhar itens raros ou bem meia boca. Tudo dependerá da sorte.
       
      O jogador precisa tacar o treasure chest na bancada e acionar a alavanca. O treasure chest irá se transformar em vários itens de forma randômica no qual o jogador poderá ou não ganhar. No final, apenas um item é entregue ao jogador.
       
      Para entender melhor o seu funcionamento, segue o GIF abaixo:
       

       
       
      em data > actions > actions.xml
       
       
      em data > actions > scripts > crie um arquivo chamado leverTreasureChest.lua
       
       
      no banco de dados do servidor, adicione o seguinte código em "SQL":
       
       
       

      Também estou disponibilizando uma página PHP, para quem quiser usar no site do servidor. Na página tem informações sobre o funcionamento, quais são os possíveis prêmios e a lista de jogadores que ganharam os itens raros.
       

       
       
      Espero ter ajudado de alguma forma! : )
       
      treasure_chest.php
    • Por 4Marsupilami
      I present my newest beautiful and tasty layout called Silver brown cake. If you are interested in a unique layout, write to me on discord.
       
      • E-mail: [email protected]
      • Discord: 4Marsupilami#1243
       
       


    • Por 4Marsupilami
      I present my newest beautiful and tasty layout called Glacial. If you are interested in a unique layout, write to me on discord.

      • E-mail: [email protected]
      • Discord: 4Marsupilami#1243
       
       


    • Por luanluciano93
      Olá pessoal, hoje vou ensinar como deixar as urls limpas (amigáveis) no Gesior.

      Mas Luan, oque é URL?
      URL vem de Uniform Resource Locator, em português Localizador-Padrão de Recursos, é o vulgo endereço de uma rede, seja internet, ou até mesmo uma intranet. Resumindo é o endereço que você coloca no seu browser.

      exemplo: URL para entrar no TK: http://www.tibiaking.com/forum/

      Como podem ver no exemplo, a estrutura de uma URL é basicamente esse:
      protocolo://dominio-ou-ip/caminho
       
      Mas Luan, para que vou querer limpar as urls do meu site?
      Seguinte, existe um termo que se chama 'boas praticas', que a maioria (não todos)dos desenvolvedores web procuram seguir. A verdade é que a única coisa que altera é o visual, você vai ver as urls, e com elas limpas qualquer leigo consegue entender onde está em um site.

      Mas Luan, oque é realmente uma URL limpa (amigável)?
      Bom, vou usar o próprio site do tibia.com (que é o mesmo jeito do Gesior) como exemplo ... 

      tibia.com/index.php?subtopic=latestnews
      tibia.com/index.php?subtopic=archives
      tibia.com/index.php?subtopic=rules

      E etc ... o tibia.com ainda não fica tão feio, mas existem sites que ficam muito ruim mesmo.

      E se colocássemos um arquivo simples no gesior que alterasse as urls escondendo uma parte delas ... 

      Por exemplo, nos exemplos acima, temos algo em comum depois do domínio, que seria o index.php?subtopic=, e se escondêssemos essa parte? Não ficaria muito melhor?
      tibia.com/latestnews
      tibia.com/archives
      tibia.com/rules

      Apenas olhando no endereço da internet qualquer leigo entenderia onde está facilmente, e é isso que este arquivo faz. bem básico.

      Luan, como eu instalo esse arquivo?
      Usamos o arquivo .htaccess e determinado código nele.

      Basta coloca esse arquivo no diretório do site (pasta www ou htdocs) com o código.

      Para funcionar você terá um pequeno trabalho de alterar todos os 'caminhos' que existem no layout e nas pastas do ot, mas é simples, vá em cada arquivo e aperta Ctrl+F e procure por subtopic e muda o caminho, no caso se tiver o index.php?subtopic=, é só apagar tudo e deixar só que esta depois do =, se não tiver o index.php, só tiver ?subtopic=, apaga essa parte e deixa só o que ta depois do =, simples e fácil, só fazer isso na layout.php e em todas as páginas que tiver no seu site.

      Se você já tem o arquivo .htaccess no diretório do seu site, coloque esse código dentro:
      RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?subtopic=$1 Caso não tenha o arquivo, provavelmente existe um arquivo .htaccess na pasta config do seu site, copie ele e cole no diretório do site, apague o código e coloque o código que eu passei.

      É isso pessoal, espero que tenham gostado. Até a próxima, abração!
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo