Ir para conteúdo

(Resolvido)[AJUDA] Guild shop não está enviando os itens para os players

Featured Replies

Postado

Em globalevents troque seu sistema de entrega por esse:
Xml:

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

shopguild.lua:
 

-- <globalevent name="GuildShop" interval="30000" script="shopguild.lua"/>

function onThink(interval, lastExecution)
	
	local queryShop = db.storeQuery('SELECT * FROM `z_ots_guildcomunication`;')
	if queryShop ~= false then
		repeat
			local id, player = result.getNumber(queryShop, 'id'), Player(result.getString(queryShop, 'name'))
			if player then
				local item_id, item_count = result.getNumber(queryShop, 'param1'), result.getNumber(queryShop, 'param2')
				local container_id, container_count = result.getNumber(queryShop, 'param3'), result.getNumber(queryShop, 'param4')
				local offer_type = result.getString(queryShop, 'param5')
				local item_name = result.getString(queryShop, 'param6')

				-- ITEM
				if offer_type == 'item' then
					player:getInbox():addItem(item_id, item_count, INDEX_WHEREEVER, FLAG_NOLIMIT)
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop em seu depot.')
				
				-- CONTAINER
				elseif offer_type == 'container' then
					local container_id, container_count = result.getNumber(queryShop, 'param3'), result.getNumber(queryShop, 'param4')
					local i, new_container = 0, player:getInbox():addItem(container_id, 1, INDEX_WHEREEVER, FLAG_NOLIMIT)
					while i ~= container_count do
						new_container:addItem(item_id, item_count, INDEX_WHEREEVER, FLAG_NOLIMIT)
						i = i + 1
					end
				
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop em seu depot.')
				
				-- ADDON
				elseif offer_type == 'addon' then
					player:addOutfitAddon(item_id, 3)
					player:addOutfitAddon(item_count, 3) 
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..'<< do guild shop.')
					
				-- MOUNT
				elseif offer_type == 'mount' then
					player:addMount(item_id)
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop.')
				end

				db.asyncQuery('DELETE FROM `z_ots_guildcomunication` WHERE `id` = ' .. id)
				db.asyncQuery('UPDATE `z_shopguild_history_item` SET `trans_state` = \'realized\', `trans_real` = ' .. os.time() .. ' WHERE id = '..id..';')
			end
		
		until not result.next(queryShop)
		result.free(queryShop)
	end

	return true
end
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

  • Respostas 17
  • Visualizações 2.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Vou tentar te ajudar...  Antes de tudo, faça backup de todos os arquivos do seu shop.   Em globalevents.xml verifique se há isso no arquivo: <globalevent name="shop" interval="30" script="shop

  • As informações passadas até aqui estão erradas. Na sua database provavelmente não existe a coluna "z_ots_guildcomunication", execute a query abaixo no phpmyadmin, compre o item novamente, e veja se

  • Pelo que vi no arquivo.php tem essa tabela, se ao comprar um item no shop, for adicionado algo lá, está funcionando perfeitamente essa parte, o problema é o script para enviar ao player o item da tabe

Postado
  • Autor

Não funcionou... Está dando um erro na distro agora:

Awr1IYL.png?1

 

Não tenho muito conhecimento para resolver :(

Desculpe estar tomando seu tempo, mas obrigado por tentar me ajudar

nbeTETb.png?1

 

Postado

Tenta:
 

-- <globalevent name="GuildShop" interval="30000" script="shopguild.lua"/>

function onThink(interval, lastExecution)
	
	local queryShop = db.storeQuery('SELECT * FROM `z_ots_guildcomunication`;')
	if queryShop ~= false then
		repeat
			local id, player = tonumber(result.getString(queryShop, 'id')), Player(result.getString(queryShop, 'name'))
			if player then
				local item_id, item_count = tonumber(result.getString(queryShop, 'param1')), tonumber(result.getString(queryShop, 'param2'))
				local container_id, container_count = tonumber(result.getString(queryShop, 'param3')), tonumber(result.getString(queryShop, 'param4'))
				local offer_type = result.getString(queryShop, 'param5')
				local item_name = result.getString(queryShop, 'param6')

				-- ITEM
				if offer_type == 'item' then
					player:getInbox():addItem(item_id, item_count, INDEX_WHEREEVER, FLAG_NOLIMIT)
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop em seu depot.')
				
				-- CONTAINER
				elseif offer_type == 'container' then
					local container_id, container_count = result.getNumber(queryShop, 'param3'), result.getNumber(queryShop, 'param4')
					local i, new_container = 0, player:getInbox():addItem(container_id, 1, INDEX_WHEREEVER, FLAG_NOLIMIT)
					while i ~= container_count do
						new_container:addItem(item_id, item_count, INDEX_WHEREEVER, FLAG_NOLIMIT)
						i = i + 1
					end
				
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop em seu depot.')
				
				-- ADDON
				elseif offer_type == 'addon' then
					player:addOutfitAddon(item_id, 3)
					player:addOutfitAddon(item_count, 3) 
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..'<< do guild shop.')
					
				-- MOUNT
				elseif offer_type == 'mount' then
					player:addMount(item_id)
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop.')
				end

				db.asyncQuery('DELETE FROM `z_ots_guildcomunication` WHERE `id` = ' .. id)
				db.asyncQuery('UPDATE `z_shopguild_history_item` SET `trans_state` = \'realized\', `trans_real` = ' .. os.time() .. ' WHERE id = '..id..';')
			end
		
		until not result.next(queryShop)
		result.free(queryShop)
	end

	return true
end

Se não funcionar, vá na lib, e procure por um arquivo que contém o nome database ou parecido com esse e poste aqui.

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Postado

Não tem a lib... Essa vai ser minha última tentativa pois, não sei as funções certas de se lidar com query no tfs 1.0.

-- <globalevent name="GuildShop" interval="30000" script="others/shopguild.lua"/>

function onThink(interval, lastExecution)
	
	local queryShop = db.storeQuery('SELECT * FROM `z_ots_guildcomunication`;')
	if queryShop ~= false then
		repeat
			local id, player = result.getDataInt(queryShop, 'id'), Player(result.getDataString(queryShop, 'name'))
			if player then
				local item_id, item_count = result.getDataInt(queryShop, 'param1'), result.getDataInt(queryShop, 'param2')
				local container_id, container_count = result.getDataInt(queryShop, 'param3'), result.getDataInt(queryShop, 'param4')
				local offer_type = result.getDataString(queryShop, 'param5')
				local item_name = result.getDataString(queryShop, 'param6')

				-- ITEM
				if offer_type == 'item' then
					player:getInbox():addItem(item_id, item_count, INDEX_WHEREEVER, FLAG_NOLIMIT)
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop em seu depot.')
				
				-- CONTAINER
				elseif offer_type == 'container' then
					local container_id, container_count = result.getDataInt(queryShop, 'param3'), result.getDataInt(queryShop, 'param4')
					local i, new_container = 0, player:getInbox():addItem(container_id, 1, INDEX_WHEREEVER, FLAG_NOLIMIT)
					while i ~= container_count do
						new_container:addItem(item_id, item_count, INDEX_WHEREEVER, FLAG_NOLIMIT)
						i = i + 1
					end
				
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop em seu depot.')
				
				-- ADDON
				elseif offer_type == 'addon' then
					player:addOutfitAddon(item_id, 3)
					player:addOutfitAddon(item_count, 3) 
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..'<< do guild shop.')
					
				-- MOUNT
				elseif offer_type == 'mount' then
					player:addMount(item_id)
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Voce recebeu >> '.. item_name ..' << do guild shop.')
				end

				db.asyncQuery('DELETE FROM `z_ots_guildcomunication` WHERE `id` = ' .. id)
				db.asyncQuery('UPDATE `z_shopguild_history_item` SET `trans_state` = \'realized\', `trans_real` = ' .. os.time() .. ' WHERE id = '..id..';')
			end
		
		until not result.next(queryShop)
		result.free(queryShop)
	end

	return true
end
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo