SO

Script Auto Gold

Por Sofft, 24 de abr. de 2012 em Scripts

gold
auto
script
ajuda
otserv
tibia
5
2.1k
SofftS
24 de abril de 2012 às 22:05

Estou usando um script para o jogador 'catar' gold automaticamente, porem isso não ocorre em monstros 'novos', como lizards, souleaters, drakens.

Por favor me ajudem a consertar isso, tem muito tempo que já estou tentando arruma isso.

Alguém mais experiente poderia facilmente conserta-lo.

 

function getContainerItems(containeruid)
	local items = {}
	local containers = {}
	if type(getContainerSize(containeruid)) ~= "number" then
			return false
	end
	for slot = 0, getContainerSize(containeruid)-1 do
			local item = getContainerItem(containeruid, slot)
			if item.itemid == 0 then
					break
			end
			if isContainer(item.uid) then
					table.insert(containers, item.uid)
			end
			table.insert(items, item)
	end
	if #containers > 0 then
			for i,x in ipairs(getContainerItems(containers[1])) do
					table.insert(items, x)
			end
			table.remove(containers, 1)
	end	
	return items
end
function getItemsInContainerById(container, itemid) -- Function By Kydrai
			local items = {}
			if isContainer(container) and getContainerSize(container) > 0 then
							for slot=0, (getContainerSize(container)-1) do
											local item = getContainerItem(container, slot)
											if isContainer(item.uid) then
															local itemsbag = getItemsInContainerById(item.uid, itemid)
															for i=0, #itemsbag do
																			table.insert(items, itemsbag[i])
															end
											else
															if itemid == item.itemid then
																			table.insert(items, item.uid)
															end
											end
							end
			end
			return items
end
function doPlayerAddItemStacking(cid, itemid, quant)
	local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
	local piles = 0
	if #item > 0 then
			for i,x in pairs(item) do
					if getThing(x).type < 100 then
							local it = getThing(x)
							doTransformItem(it.uid, itemid, it.type+quant)
							if it.type+quant > 100 then
									doPlayerAddItem(cid, itemid, it.type+quant-100)
							end
					else
					   piles = piles+1
					end
			end
	else
			return doPlayerAddItem(cid, itemid, quant)
	end
	if piles == #item then
			doPlayerAddItem(cid, itemid, quant)
	end
end
function corpseRetireItems(corpsepos, killer, itemsarray)
	local corpse = nil
	for i = 1, 254 do
			corpsepos.stackpos = i
			corpse = getThingFromPos(corpsepos)
			if corpse.uid > 0 and isCorpse(corpse.uid) then
					break
			end
	end
	local items = getContainerItems(corpse.uid)
	for i,x in pairs(items) do
			if isInArray(itemsarray, tonumber(x.itemid)) then
					if isItemStackable(x.itemid) then
							doPlayerAddItemStacking(killer, x.itemid, x.type)
					else
							doPlayerAddItem(killer, x.itemid)
					end
					doRemoveItem(x.uid, x.type)
			end
	end
end
function onKill(cid, target, lastHit)
	local loots = {2148, 2152, 2160}
	if lastHit and getPlayerStorageValue(cid, 6616) == 1 then
			addEvent(corpseRetireItems, 100, getCreaturePosition(target), cid, loots)
	end
	return true
end

Creditos:MatheusMkalo, por postar esse script.

Link do Tópico dele:http://www.xtibia.co...tion-auto-gold/

 

COMO SEMPRE!!, NINGUEM AJUDA A RESOLVER NADA AQUI, A NÃO SER FAZER BAÚ DE QUEST!!!!!

RESOLVIDO: Se você tiver o mesmo problema do que eu, o erro não está no script, mas no monstro, adicione essa tag no corpse do monstro, que fica em items.xml.

<attribute key="corpseType" value="Blood" />

Editado Abril 25 por Sofft

jhon992J
25 de abril de 2012 às 09:49

#Reportado, por duvida sanada.

 

@Sofft, vc n pode generalizar falando que ninguem ajuda, tem varios no forum que sempre ajudam quando podem. Eu só vi esse pedido agora que vc ja sanou, senão tinha tentado ajudar...

caoticC
25 de abril de 2012 às 10:28

jhom disse eu tbm estou tentando ajudar todos so que os pedidos sao muitos e alguns sao mais complexos e demoram mais.

SofftS
25 de abril de 2012 às 11:21

Então vou aproveitar a boa vontade de vcs, se puderem me ajudar nesse tópico ficaria muito agradecido:

http://www.xtibia.com/forum/topic/184353-problema-com-itens-agrupaveis-empilhaveis/page__fromsearch__1

1 ano depois...
AsLimaA
30 de julho de 2013 às 15:42

Gostaria desse script em meu otserv, mas gostaria apenas para jogadores VIP.

 

Ajuda plx! ;)