Ir para conteúdo
  • Cadastre-se

[8.6] [Talkactions] - Find Item


Posts Recomendados

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

Link para o post
Compartilhar em outros sites

Otimo, baseado naquele pra 1.x né?

Apesar de não usar essa versão de tfs, to lgd que vai ajudar mt gente.

 

@This life is filled with hurt

When happiness doesn't work

Trust me and take my hand

When the lights go out you will understand

Link para o post
Compartilhar em outros sites
4 horas atrás, login12 disse:

Otimo, baseado naquele pra 1.x né?

Apesar de não usar essa versão de tfs, to lgd que vai ajudar mt gente.

 

eu já fiz pra tfs 1.1+ tbm '-'

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
  • 4 years later...
Em 29/12/2016 em 00:25, Vodkart disse:

É um comando para procurar determinado item no servidor, ele procura em:

 

*Jogador

*Depot

*House Tiles

 

basta usar o comando /find NOME DO ITEM

 

exemplo: /find solar axe

 

GYIwJ7e.jpg

 

sr6bRn7.jpg

 

7Dj0LgC.jpg

 

 

Obs: Como é feito por DB, os items só ficaram salvo quando der serve save(hora que altera os valores na data base), então se o jogador receber o item as 15:00 e só de serve save as 16:00, só irá aparecer no comando as 16:00 horas.

 

 

 

talkactions

 

finditem.lua


function onSay(cid, words, param)
	if param == '' or tonumber(param) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "/find item name")
		return true
	end
	local item_id = getItemIdByName(tostring(param), false) 
	if not item_id then
		doPlayerSendCancel(cid, "This item does not exist.") return true
	end
	local str, player_depotitems, players_items, tile_items = "",{},{},{}
	local dp = db.getResult("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = "..item_id),{}
	if (dp:getID() ~= -1) then
		repeat
			player_depotitems[#player_depotitems+1] = {dp:getDataInt("player_id"), dp:getDataInt("count") }
		until not(dp:next())
		dp:free()
	end
	local pi = db.getResult("SELECT `player_id`, `count` FROM `player_items` WHERE `itemtype` = "..item_id),{}
	if (pi:getID() ~= -1) then
		repeat
			players_items[#players_items+1] = {pi:getDataInt("player_id"), pi:getDataInt("count") }
		until not(pi:next())
		pi:free()
	end
	local hi = db.getResult("SELECT `tile_id`, `count` FROM `tile_items` WHERE `itemtype` = "..item_id),{}
	if (hi:getID() ~= -1) then
		repeat
			local tile = db.getResult("SELECT `house_id`, `x`, `y`, `z` FROM `tiles` WHERE `id` = "..hi:getDataInt("tile_id")),{}
			tile_items[#tile_items+1] = {tile:getDataInt("house_id"),tile:getDataInt("x"),tile:getDataInt("y"),tile:getDataInt("z")}
		until not(hi:next())
		hi:free()
	end	 
	if #player_depotitems > 0 then
		str = str .. "#DEPOT ITEMS#\nQuantidade - Jogador\n"
		for i = 1, table.maxn(player_depotitems) do
			str = str .. player_depotitems[i][2] .. ' ' .. getPlayerNameByGUID(player_depotitems[i][1]) ..' \n'
		end
	end
	if #players_items > 0 then
		str = str .. (str ~= "" and "--------------//-------------\n\n#PLAYER ITEMS#\nQuantidade - Jogador\n" or "#PLAYER ITEMS#\nQuantidade - Jogador\n") 
		for i = 1, table.maxn(players_items) do
			str = str .. players_items[i][2] .. ' ' .. getPlayerNameByGUID(players_items[i][1]) ..' \n'
		end
	end
	if #tile_items > 0 then
		str = str .. (str ~= "" and "--------------//-------------\n\n#TILE ITEMS#\nHouse ID - Tile Position\n" or "#TILE ITEMS#\nHouse ID -Tile Position\n") 
		for i = 1, table.maxn(tile_items) do
			str = str .. tile_items[i][1] .. ' - {x = ' .. tile_items[i][2] ..', y = ' .. tile_items[i][3] ..', z = ' .. tile_items[i][4] ..'} \n'
		end
	end
	return doShowTextDialog(cid,item_id, str)
end

 

TAG


<talkaction log="yes" words="!find;/find" access="5" event="script" value="finditem.lua"/>

 

Não funciona em TFS 0.4 =/ ao utilizar o comando e colocar o item diz que não existe.

Usei /find magic plate armor

E na distro aparece esse erro:

 

[Error - TalkAction Interface]
data/talkactions/scripts/finditem.lua:onSay
Description:
(LuaInterface::luaGetItemIdByName) Item not found

Link para o post
Compartilhar em outros sites
59 minutos atrás, vine96 disse:

Não funciona em TFS 0.4 =/ ao utilizar o comando e colocar o item diz que não existe.

Usei /find magic plate armor

E na distro aparece esse erro:

 

[Error - TalkAction Interface]
data/talkactions/scripts/finditem.lua:onSay
Description:
(LuaInterface::luaGetItemIdByName) Item not found

 

n existe o parâmetro false na função do seu servidor... usa assim:

 

 

function ExistItemByName(name) -- by vodka
	local items = io.open("data/items/items.xml", "r"):read("*all")
	local get = items:lower():match('name="' .. name:lower() ..'"')
	if get == nil or get == "" then
		return false
	end
	return true
end
function onSay(cid, words, param)
	if param == '' or tonumber(param) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "/find item name")
		return true
	end
	local item = ExistItemByName(tostring(param))
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.") return true
	end
	local item_id = getItemIdByName(tostring(param))
	local str, player_depotitems, players_items, tile_items = "",{},{},{}
	local dp = db.getResult("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = "..item_id),{}
	if (dp:getID() ~= -1) then
		repeat
			player_depotitems[#player_depotitems+1] = {dp:getDataInt("player_id"), dp:getDataInt("count") }
		until not(dp:next())
		dp:free()
	end
	local pi = db.getResult("SELECT `player_id`, `count` FROM `player_items` WHERE `itemtype` = "..item_id),{}
	if (pi:getID() ~= -1) then
		repeat
			players_items[#players_items+1] = {pi:getDataInt("player_id"), pi:getDataInt("count") }
		until not(pi:next())
		pi:free()
	end
	local hi = db.getResult("SELECT `tile_id`, `count` FROM `tile_items` WHERE `itemtype` = "..item_id),{}
	if (hi:getID() ~= -1) then
		repeat
			local tile = db.getResult("SELECT `house_id`, `x`, `y`, `z` FROM `tiles` WHERE `id` = "..hi:getDataInt("tile_id")),{}
			tile_items[#tile_items+1] = {tile:getDataInt("house_id"),tile:getDataInt("x"),tile:getDataInt("y"),tile:getDataInt("z")}
		until not(hi:next())
		hi:free()
	end	 
	if #player_depotitems > 0 then
		str = str .. "#DEPOT ITEMS#\nQuantidade - Jogador\n"
		for i = 1, table.maxn(player_depotitems) do
			str = str .. player_depotitems[i][2] .. ' ' .. getPlayerNameByGUID(player_depotitems[i][1]) ..' \n'
		end
	end
	if #players_items > 0 then
		str = str .. (str ~= "" and "--------------//-------------\n\n#PLAYER ITEMS#\nQuantidade - Jogador\n" or "#PLAYER ITEMS#\nQuantidade - Jogador\n") 
		for i = 1, table.maxn(players_items) do
			str = str .. players_items[i][2] .. ' ' .. getPlayerNameByGUID(players_items[i][1]) ..' \n'
		end
	end
	if #tile_items > 0 then
		str = str .. (str ~= "" and "--------------//-------------\n\n#TILE ITEMS#\nHouse ID - Tile Position\n" or "#TILE ITEMS#\nHouse ID -Tile Position\n") 
		for i = 1, table.maxn(tile_items) do
			str = str .. tile_items[i][1] .. ' - {x = ' .. tile_items[i][2] ..', y = ' .. tile_items[i][3] ..', z = ' .. tile_items[i][4] ..'} \n'
		end
	end
	return doShowTextDialog(cid,item_id, str)
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
36 minutos atrás, Apache disse:

@Vodkart teria como fazer para buscar um item pelo serial gerado ao comprar no site?

 

O serial fica no nome do item ou em alguma descrição?

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo