Ir para conteúdo
  • Cadastre-se

Posts Recomendados

estou com problemas com meu autoloot no 8.6 usando tfs 0.3.6

 

imagem abaixo do erro:

e97lwzn.png

 

Código do Autoloot:

-- Sistema de auto loot criado por Henrique Matheus - HServers

local tabela = {}

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 0442002) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442002))
	end
	if getPlayerStorageValue(cid, 0442003) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442003))
	end
	if getPlayerStorageValue(cid, 0442004) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442004))
	end
	if getPlayerStorageValue(cid, 0442005) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442005))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function autoLoot(cid, pos)
	local check = false
	local str = ""
	local position = {}
	for i = 1, 255 do
		pos.stackpos = i
		if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then
			position = pos
			check = true
			break
		end
	end
	if check then
		local corpse = getContainerItemsInfo(getThingFromPos(position).uid)		
		if corpse then
			for index, info in pairs(corpse) do
				if index < countTable(corpse) then
    					if tonumber(info.uid) and tonumber(info.itemid) then
						if isContainer(info.uid) then
							local bag = getContainerItemsInfo(info.uid)
							for i = 1, countTable(bag) - 1 do
								if isInArray(getPlayerList(cid), bag[i].itemid) then
									if bag[i].quant > 1 then
										doRemoveItem(bag[i].uid, bag[i].quant)
										doPlayerAddItem(cid, bag[i].itemid, bag[i].quant)
										str = str.." "..bag[i].quant.." "..getItemNameById(bag[i].itemid)..","
									else
										doRemoveItem(bag[i].uid)
										doPlayerAddItem(cid, bag[i].itemid, 1)
										str = str.." 1 "..getItemNameById(bag[i].itemid)..","
									end
								end
							end
						end
					end
				end
				if isInArray(getPlayerList(cid), info.itemid) then
					if info.quant > 1 then
						doRemoveItem(info.uid, info.quant)
						doPlayerAddItem(cid, info.itemid, info.quant)
						str = str.." "..info.quant.." "..getItemNameById(info.itemid)..","
					else
						doRemoveItem(info.uid)
						doPlayerAddItem(cid, info.itemid, 1)
						str = str.." 1 "..getItemNameById(info.itemid)..","
					end
				end
			end
		end
	end
	tabela[getCreatureName(cid)] = {item = "[Auto Loot System] Coletados: "..str, gold = 0}
end

local function autoGold(cid, pos)
	local check = false
	local total = 0
	local position = {}
	for i = 1, 255 do
		pos.stackpos = i
		if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then
			position = pos
			check = true
			break
		end
	end
	if check then
		local corpse = getContainerItemsInfo(getThingFromPos(position).uid)
		if corpse then
			for index, info in pairs(corpse) do
				if info.uid and info.itemid then
					if index < countTable(corpse) then
						if isContainer(info.uid) then
							local bag = getContainerItemsInfo(info.uid)
							for i = 1, countTable(bag) - 1 do
								if isInArray({2148, 2152, 2160}, bag[i].itemid) then
									local multiplie = 1
									if bag[i].itemid == 2148 then
										multiplie = 1
									elseif bag[i].itemid == 2152 then
										multiplie = 100
									elseif bag[i].itemid == 2160 then
										multiplie = 10000
									end
									doRemoveItem(bag[i].uid, bag[i].quant)
									doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(bag[i].quant) and tonumber(bag[i].quant) * multiplie or 0))
									total = total + (tonumber(bag[i].quant) and tonumber(bag[i].quant) * multiplie or 0)
									doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(bag[i].quant) and tonumber(bag[i].quant) * multiplie or 0))
								end
							end
						end
					end
					if isInArray({2148, 2152, 2160}, info.itemid) then
						local multiplie = 1
						if info.itemid == 2148 then
							multiplie = 1
						elseif info.itemid == 2152 then
							multiplie = 100
						elseif info.itemid == 2160 then
							multiplie = 10000
						end
    doRemoveItem(info.uid, info.quant)
						doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0))
						doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0))
						total = total + (tonumber(info.quant) and tonumber(info.quant) * multiplie or 0)
					end
				end
			end
		end
	end
	if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then
		tabela[getCreatureName(cid)].gold = total
	end
end

local function sendMsg(cid)
	if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then
		if tabela[getCreatureName(cid)].gold == 0 then
			doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item)
		else
			doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item.." "..tabela[getCreatureName(cid)].gold.." gold coins.")
		end
		tabela[getCreatureName(cid)] = nil
	end
end

function onKill(cid, target, lastHit)
	if isPlayer(cid) and isMonster(target) then
		if getPlayerStorageValue(cid, 0442100) == 1 and getPlayerList(cid) then
			local pos = getCreaturePosition(target)
			addEvent(autoLoot, 500, cid, pos)
		end
		if getPlayerStorageValue(cid, 0442101) == 1 then
			local pos = getCreaturePosition(target)
			addEvent(autoGold, 500, cid, pos)
		end
		if getPlayerStorageValue(cid, 0442100) == 1 or getPlayerStorageValue(cid, 0442101) == 1 then
			addEvent(sendMsg, 540, cid)
		end
	end
	return true
end

 

Link para o post
Compartilhar em outros sites
14 minutos atrás, gabrielt94 disse:

estou com problemas com meu autoloot no 8.6 usando tfs 0.3.6

 

imagem abaixo do erro:

e97lwzn.png

 

Código do Autoloot:


-- Sistema de auto loot criado por Henrique Matheus - HServers

local tabela = {}

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 0442002) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442002))
	end
	if getPlayerStorageValue(cid, 0442003) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442003))
	end
	if getPlayerStorageValue(cid, 0442004) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442004))
	end
	if getPlayerStorageValue(cid, 0442005) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 0442005))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function autoLoot(cid, pos)
	local check = false
	local str = ""
	local position = {}
	for i = 1, 255 do
		pos.stackpos = i
		if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then
			position = pos
			check = true
			break
		end
	end
	if check then
		local corpse = getContainerItemsInfo(getThingFromPos(position).uid)		
		if corpse then
			for index, info in pairs(corpse) do
				if index < countTable(corpse) then
    					if tonumber(info.uid) and tonumber(info.itemid) then
						if isContainer(info.uid) then
							local bag = getContainerItemsInfo(info.uid)
							for i = 1, countTable(bag) - 1 do
								if isInArray(getPlayerList(cid), bag[i].itemid) then
									if bag[i].quant > 1 then
										doRemoveItem(bag[i].uid, bag[i].quant)
										doPlayerAddItem(cid, bag[i].itemid, bag[i].quant)
										str = str.." "..bag[i].quant.." "..getItemNameById(bag[i].itemid)..","
									else
										doRemoveItem(bag[i].uid)
										doPlayerAddItem(cid, bag[i].itemid, 1)
										str = str.." 1 "..getItemNameById(bag[i].itemid)..","
									end
								end
							end
						end
					end
				end
				if isInArray(getPlayerList(cid), info.itemid) then
					if info.quant > 1 then
						doRemoveItem(info.uid, info.quant)
						doPlayerAddItem(cid, info.itemid, info.quant)
						str = str.." "..info.quant.." "..getItemNameById(info.itemid)..","
					else
						doRemoveItem(info.uid)
						doPlayerAddItem(cid, info.itemid, 1)
						str = str.." 1 "..getItemNameById(info.itemid)..","
					end
				end
			end
		end
	end
	tabela[getCreatureName(cid)] = {item = "[Auto Loot System] Coletados: "..str, gold = 0}
end

local function autoGold(cid, pos)
	local check = false
	local total = 0
	local position = {}
	for i = 1, 255 do
		pos.stackpos = i
		if getThingFromPos(pos).uid and getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then
			position = pos
			check = true
			break
		end
	end
	if check then
		local corpse = getContainerItemsInfo(getThingFromPos(position).uid)
		if corpse then
			for index, info in pairs(corpse) do
				if info.uid and info.itemid then
					if index < countTable(corpse) then
						if isContainer(info.uid) then
							local bag = getContainerItemsInfo(info.uid)
							for i = 1, countTable(bag) - 1 do
								if isInArray({2148, 2152, 2160}, bag[i].itemid) then
									local multiplie = 1
									if bag[i].itemid == 2148 then
										multiplie = 1
									elseif bag[i].itemid == 2152 then
										multiplie = 100
									elseif bag[i].itemid == 2160 then
										multiplie = 10000
									end
									doRemoveItem(bag[i].uid, bag[i].quant)
									doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(bag[i].quant) and tonumber(bag[i].quant) * multiplie or 0))
									total = total + (tonumber(bag[i].quant) and tonumber(bag[i].quant) * multiplie or 0)
									doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(bag[i].quant) and tonumber(bag[i].quant) * multiplie or 0))
								end
							end
						end
					end
					if isInArray({2148, 2152, 2160}, info.itemid) then
						local multiplie = 1
						if info.itemid == 2148 then
							multiplie = 1
						elseif info.itemid == 2152 then
							multiplie = 100
						elseif info.itemid == 2160 then
							multiplie = 10000
						end
    doRemoveItem(info.uid, info.quant)
						doPlayerSetBalance(cid, getPlayerBalance(cid) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0))
						doPlayerSetStorageValue(cid, 0442102, getPlayerStorageZero(cid, 0442102) + (tonumber(info.quant) and tonumber(info.quant) * tonumber(multiplie) or 0))
						total = total + (tonumber(info.quant) and tonumber(info.quant) * multiplie or 0)
					end
				end
			end
		end
	end
	if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then
		tabela[getCreatureName(cid)].gold = total
	end
end

local function sendMsg(cid)
	if tabela[getCreatureName(cid)] and tabela[getCreatureName(cid)].gold then
		if tabela[getCreatureName(cid)].gold == 0 then
			doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item)
		else
			doPlayerSendTextMessage(cid, 23, tabela[getCreatureName(cid)].item.." "..tabela[getCreatureName(cid)].gold.." gold coins.")
		end
		tabela[getCreatureName(cid)] = nil
	end
end

function onKill(cid, target, lastHit)
	if isPlayer(cid) and isMonster(target) then
		if getPlayerStorageValue(cid, 0442100) == 1 and getPlayerList(cid) then
			local pos = getCreaturePosition(target)
			addEvent(autoLoot, 500, cid, pos)
		end
		if getPlayerStorageValue(cid, 0442101) == 1 then
			local pos = getCreaturePosition(target)
			addEvent(autoGold, 500, cid, pos)
		end
		if getPlayerStorageValue(cid, 0442100) == 1 or getPlayerStorageValue(cid, 0442101) == 1 then
			addEvent(sendMsg, 540, cid)
		end
	end
	return true
end

 

Tente substituir por isso:

Citar

local stor, limit = 7575, 5 --storage, limit to add.


local allow_container = false --empty! not looted with items, atleast for now.


function onSay(cid, words, param)

	local expl = param:explode(':')

	local action, rst = expl[1], expl[2]

	if (action:lower() == 'check') then

		local infos, list = getPlayerStorageValue(cid, stor), {}

		if (infos ~= -1) then

			list = tostring(infos):explode(',')

		end

		local txt = 'Autoloot List:\n'

		if (#list > 0) then

			for k, id in ipairs(list) do

				id = id:gsub('_', '')

				if tonumber(id) then

					txt = txt .. getItemNameById(tonumber(id)) .. ((k < #list) and '\n' or '')

				end

			end

		else

			txt = 'Empty'

		end

		doPlayerPopupFYI(cid, txt)

	elseif (action:lower() == 'add') then

		local infos, list = getPlayerStorageValue(cid, stor), {}

		if (infos ~= -1) then

			list = tostring(infos):gsub('_', ''):explode(',')

		end

		if (#list >= limit) then

			return doPlayerSendCancel(cid, 'You already have ' .. limit .. ' autolooting items.')

		end

		local item = tonumber(rst)

		if not item then

			item = getItemIdByName(rst, false)

			if not item then

				return doPlayerSendCancel(cid, 'not valid item.')

			end

		end

		if not allow_container and isItemContainer(item) then

			return doPlayerSendCancel(cid, 'this item can not be autolooted.')

		end

		local attrs = getItemInfo(item)

		if not attrs then

			return doPlayerSendCancel(cid, 'not valid item.')

		elseif not attrs.movable or not attrs.pickupable then

			return doPlayerSendCancel(cid, 'this item can not be autolooted.')

		end

		if isInArray(list, item) then

			return doPlayerSendCancel(cid, 'already added.')

		end

		table.insert(list, tostring(item))

		local new = ''

		for v, id in ipairs(list) do

			new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')

		end

		doPlayerSetStorageValue(cid, stor, tostring(new))

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< has been added to the autoloot list.')

	elseif (action:lower() == 'remove') then

		local infos, list = getPlayerStorageValue(cid, stor), {}

		if (infos ~= -1) then

			list = tostring(infos):gsub('_', ''):explode(',')

		end

		if (#list == 0) then

			return doPlayerSendCancel(cid, 'You dont have any item added.')

		end

		if (#list >= limit) then

			return doPlayerSendCancel(cid, 'You already have ' .. limit .. ' autolooting items.')

		end

		local item = tonumber(rst)

		if not item then

			item = getItemIdByName(rst, false)

			if not item then

				return doPlayerSendCancel(cid, 'not valid item.')

			end

		end

		if not isInArray(list, item) then

			return doPlayerSendCancel(cid, 'This item is not in the list.')

		end

		local new = ''

		for v, id in ipairs(list) do

			if (tonumber(id) ~= item) then

				new = new .. '_' .. id:gsub('_' ,'') .. ((v < #list) and ',' or '')

			end

		end

		doPlayerSetStorageValue(cid, stor, tostring(new))

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Item >>' .. getItemNameById(item) .. '<< removed from the autoloot list.')

	end		

	return true

end

Volte para nos dizer se funcionou.

 

             Te ajudei ? Deixa aquele REP+ pra fortalecer, basta clicar em GOSTEI

                                                       housefoda.gif

                                        tk-melhor.png

Talvez você queira ver:

BestBaiak

[FAQ]Remere's Map Editor - Dúvidas e soluções de bugs 

 

Contato:

1.png.dadb3fc3ee6ffd08292705b6a71e3d88.png Discord:

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 FeeTads
      salve rapaziada, do TK, esses tempos eu tava a procura de um autoloot bom e eficiente, e como vocês devem saber, o autoloot usado nos scripts .lua são bem "pesados"
      o @Naze fez um excelentíssimo trabalho e disponibilizou um script de autoloot na source, porém como a vida é dificil, ele tem alguns bugs de função e um deles é no 
      "remove autoloot" que quando o player digita "!autoloot remove, nome-do-item" nada acontece, eu decidi mexer e vim disponibilizar arrumado pra vcs.
      LEMBRANDO QUE 100% DOS CRÉDITOS SÃO AO @Naze porém se vc procurar no tópico dele ainda vai estar bugado, então resolvi deixar aqui certinho pra ajudar quem precisar.


      Link do tópico do naze: https://tibiaking.com/forums/topic/101086-otimizado-autoloot-in-sources-for-otx2-ou-menor/
       

      caso alguém ja utilize esse autoloot e esteja com o problema de remover items do autoloot
      só ir em player.cpp e trocar

      isso:
       
      void Player::removeAutoLoot(uint16_t id) { if(checkAutoLoot(id)) { return; } AutoLoot.remove(id); }
      por isso:
      void Player::removeAutoLoot(uint16_t id) { if(!checkAutoLoot(id)) return; for(std::list<uint16_t>::iterator it = AutoLoot.begin(); it != AutoLoot.end(); ++it) { if((*it) == id) { AutoLoot.erase(it); break; } } }
      todos os créditos ao Naze, não sei se alguém mais fez esse código, mas como peguei do link citado acima que é post dele deixo aqui o autoloot 100% funcional direto nas sources
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por Featzen
      Bom, vi por aqui e não achei nenhum autoloot igual o da pxg ou sem bugs, então decidi vir aqui postar o que eu fiz.
      Vamos lá.
       
      1º - Vá na pasta Lib, no arquivo some functions.lua e adicione isso depois do ultimo "end":



       
      2º - Vá em actions/script e crie um arquivo.lua com nome de Autoloot, dentro coloque:



       
      Agora, no actions.xml adicione a tag:
      <action itemid="" event="script" value="Autoloot.lua"/> Dentro de itemid="", coloque o id dos corpses.
       
      Para conseguir o id dos corpses, podemos fazer um pequeno script, que pegará o corpse de cada pokemon capturável.



       
      Clique em: Execute Script e terá todos os corpses de pokemons capturáveis.

      Créditos:
      Mkalo -- Auto Stacking
      Gabriel Sales(eu) -- Resto
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo