Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Olá galera, venho aqui pedir socorro a vocês novamente... Encontrei um script de auto loot aqui no forum que funcionou perfeitamente, porém, agora perto da inauguração do meu server estou precisando fazer uns ajustes. 

 

DUVIDA

 

1>Não sei como faço para limitar a quantidade de itens... Atualmente é possivel colocar mais de 10 itens, gostaria de limitar a 4.

2>Gostaria também de aumentar o limite, porém, só para premiuns, no script já tem a função de colocar somente premium, mas gostaria que os players Free pudesse colocar até 4 itens, e os p.a (VIP) coloquem até 10.

 

Se alguem souber como fazer isso e puder me ajudar, agradeço desde já, e caso venha a jogar meu ot um dia irei recompensa-lo :p

 

Segue o script

Spoiler

<?xml version="1.0" encoding="ISO-8859-1"?>  

<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  

<config name="Loot_func"><![CDATA[


info = {

OnlyPremium = false,

AutomaticDeposit = true,

BlockMonsters = {},

BlockItemsList = {2123,2515}

}


function setPlayerStorageTable(cid, storage, tab)

    local tabstr = "&"

    for i,x in pairs(tab) do

            tabstr = tabstr .. i .. "," .. x .. ";"

    end

    setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))

end

function getPlayerStorageTable(cid, storage)

    local tabstr = getPlayerStorageValue(cid, storage)

    local tab = {}

    if type(tabstr) ~= "string" then

            return {}

    end

    if tabstr:sub(1,1) ~= "&" then

            return {}

    end

    local tabstr = tabstr:sub(2, #tabstr)

    local a = string.explode(tabstr, ";")

    for i,x in pairs(a) do

            local b = string.explode(x, ",")

            tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]

    end

    return tab

end


function isInTable(cid, item)

         for _,i in pairs(getPlayerStorageTable(cid, 27000))do

             if tonumber(i) == tonumber(item) then

                return true

             end

         end

return false

end

function addItemTable(cid, item)

         local x = {}

               for i = 1,#getPlayerStorageTable(cid, 27000) do

                   table.insert(x,getPlayerStorageTable(cid, 27000))

               end

               if x ~= 0 then

                  table.insert(x,tonumber(item))

                  setPlayerStorageTable(cid, 27000, x)

               else

                   setPlayerStorageTable(cid, 27000, {item})

               end

end

function removeItemTable(cid, item)

         local x = {}

               for i = 1,#getPlayerStorageTable(cid, 27000) do

                   table.insert(x,getPlayerStorageTable(cid, 27000))

               end

               for i,v in ipairs(x) do

                   if tonumber(v) == tonumber(item) then

                   table.remove(x,i)

               end

               end

         return setPlayerStorageTable(cid, 27000, x)

end

function ShowItemsTabble(cid)

local str,n = "-- My Loot List --\n\n",0

for i = 1,#getPlayerStorageTable(cid, 27000) do

n = n + 1

str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"

end

return doShowTextDialog(cid, 2529, str)

end

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)

                                                            end

                                            else

                                                            if itemid == item.itemid then

                                                                            table.insert(items, item.uid)

                                                            end

                                            end

                            end

            end

            return items

end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo

    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 AutomaticDeposit(cid,item,n)

local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)

return doPlayerDepositMoney(cid, deposit)

end

function corpseRetireItems(cid, pos)

local check = false

for i = 0, 255 do

pos.stackpos = i

tile = getTileThingByPos(pos)

if tile.uid > 0 and isCorpse(tile.uid) then

check = true break

end

end

if check == true then

     local items = getContainerItems(tile.uid)

     for i,x in pairs(items) do

             if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then

                     if isItemStackable(x.itemid) then

doPlayerAddItemStacking(cid, x.itemid, x.type)

if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then

AutomaticDeposit(cid,x.itemid,x.type)

end

                     else

                             doPlayerAddItem(cid, x.itemid)

                     end

                     doRemoveItem(x.uid)

             end

     end

end

end

]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)

registerCreatureEvent(cid, "MonsterAttack")

return true

end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')

function onDeath(cid, corpse, deathList)

local killer,pos = deathList[1],getCreaturePosition(cid)

addEvent(corpseRetireItems,1,killer,pos)

return true

end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')

if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then

registerCreatureEvent(target, "LootEventDeath")

                 end

return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')

local t = string.explode(string.lower(param), ",")

if info.OnlyPremium == true and not isPremium(cid) then

doPlayerSendCancel(cid, "you must be a premium account.") return true

elseif not t[1] then

ShowItemsTabble(cid) return true

elseif tonumber(t[1]) or tonumber(t[2]) then

doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name") return true

elseif isInArray({"add","remove"}, tostring(t[1])) then

local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false

local item = getItemIdByName(tostring(t[2]), false)

if not item then

doPlayerSendCancel(cid, "This item does not exist.") return true

elseif check == true and isInArray(info.BlockItemsList, item) then

doPlayerSendCancel(cid, "You can not add this item in the list!") return true

elseif isInTable(cid, item) == check then

doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.") return true

end

func(cid, item)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true

end

return true]]></talkaction>

</mod>

 

Bom é isso, grato também quem leu até o final, se não puder ou não quiser ajudar, de um UP e ajude um parceiro o/

Link para o post
Compartilhar em outros sites

Tente:

<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value == true then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and ShowItemsTabble(cid, true) > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and ShowItemsTabble(cid, true) > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and ShowItemsTabble(cid, true) >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and ShowItemsTabble(cid, true) >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

Bruno de Carvalho Câmara / Administrador TibiaKing

[email protected]


 

btn_donateCC_LG.gif

 

Em 26/12/2016 em 03:47, Spraypaint disse:

A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une.

-miltinho

 

wMwSJFE.png?1

 

Link para o post
Compartilhar em outros sites
2 horas atrás, Comedinha disse:

Tente:


<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value == true then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and ShowItemsTabble(cid, true) > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and ShowItemsTabble(cid, true) > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and ShowItemsTabble(cid, true) >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and ShowItemsTabble(cid, true) >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

OBRIGADO POR TENTAR AJUDAR, PORÉM, não funcionou

 

OCORRE O SEGUINTE

 

Não bugou a distro, porém, ao entrar em uma conta premium Eu dei o comando /autoloot "funcionou, mostrou a lista de itens que não tinha nenhum" 

Dei o comando /autoloot add, Sword "Funcionou, devolveu a msg falando q sword foi adicionado a lsita auto loot"

Tentei adicionar outro item, o comando n respondeu, e deu um erro na distro

56e21aa993aa6_errodistro.png.dea6fc80ac9

 

Eu tento dar /autoloot "só para ver se o item sword foi realmente adicionado ai tbm não responde e da outro erro igual" 

 

Se souber como proceder obrigado, caso não. Obrigado pela tentiva e deixe seu up pra quem sabe outra pessoa me ajudar. Vlw mano o/

Link para o post
Compartilhar em outros sites

Tente assim:

<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and ShowItemsTabble(cid, true) > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and ShowItemsTabble(cid, true) > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and tonumber(ShowItemsTabble(cid, true)) >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and tonumber(ShowItemsTabble(cid, true)) >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

Basicamente o erro que ta dando é que versões antigas da TFS quando da return 0 ou 1 volta como return false ou true...

Não me lembro se tonumber resolve o problema, mas caso aconteça novamente tenho uma ideia de como resolver...

Bruno de Carvalho Câmara / Administrador TibiaKing

[email protected]


 

btn_donateCC_LG.gif

 

Em 26/12/2016 em 03:47, Spraypaint disse:

A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une.

-miltinho

 

wMwSJFE.png?1

 

Link para o post
Compartilhar em outros sites
1 hora atrás, Comedinha disse:

Tente assim:


<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and ShowItemsTabble(cid, true) > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and ShowItemsTabble(cid, true) > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and tonumber(ShowItemsTabble(cid, true)) >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and tonumber(ShowItemsTabble(cid, true)) >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

Basicamente o erro que ta dando é que versões antigas da TFS quando da return 0 ou 1 volta como return false ou true...

Não me lembro se tonumber resolve o problema, mas caso aconteça novamente tenho uma ideia de como resolver...

De novo dando o mesmo problema, segue a imagem.

 

56e23533240f4_Denovoproblema.png.0ad34f1

Link para o post
Compartilhar em outros sites

Tenta assim, se não der desisto e.e

 

<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	local debugnumber = 0
	if ShowItemsTabble(cid, true) == false then
		debugnumber = 0
	elseif ShowItemsTabble(cid, true) == true then
		debugnumber = 1
	else
		debugnumber = ShowItemsTabble(cid, true)
	end
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and debugnumber > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and debugnumber > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local debugnumber = 0
if ShowItemsTabble(cid, true) == false then
	debugnumber = 0
elseif ShowItemsTabble(cid, true) == true then
	debugnumber = 1
else
	debugnumber = ShowItemsTabble(cid, true)
end
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and debugnumber >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and debugnumber >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

Bruno de Carvalho Câmara / Administrador TibiaKing

[email protected]


 

btn_donateCC_LG.gif

 

Em 26/12/2016 em 03:47, Spraypaint disse:

A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une.

-miltinho

 

wMwSJFE.png?1

 

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

Tenta assim, se não der desisto e.e

 


<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	local debugnumber = 0
	if ShowItemsTabble(cid, true) == false then
		debugnumber = 0
	elseif ShowItemsTabble(cid, true) == true then
		debugnumber = 1
	else
		debugnumber = ShowItemsTabble(cid, true)
	end
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and debugnumber > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and debugnumber > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local debugnumber = 0
if ShowItemsTabble(cid, true) == false then
	debugnumber = 0
elseif ShowItemsTabble(cid, true) == true then
	debugnumber = 1
else
	debugnumber = ShowItemsTabble(cid, true)
end
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and debugnumber >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and debugnumber >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

Então comédinha, no script mesmo diz que só é possivel 100, se eu nao estou enganado... Ai nao é mais facil ele mudar a quantidade ali?  OBS: Sou novo em script... 

 

			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)

 

Editado por pauliinho157 (veja o histórico de edições)

Criador, a procura de mapper e scripter para server de tibia 8.6 DEDICADO

 

| IP: real-world.servegame.com | XP: 650 | Baiak EDITED (PRÓPRIO) | DEDICADO 24horas Online | Aberto 10.12.15 |

logo.png

Link para o post
Compartilhar em outros sites

@pauliinho157 Ali você autera a quantidade de items que é pego, e não quantos registra... Ao que parece você pode registrar infinitos items...

Bruno de Carvalho Câmara / Administrador TibiaKing

[email protected]


 

btn_donateCC_LG.gif

 

Em 26/12/2016 em 03:47, Spraypaint disse:

A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une.

-miltinho

 

wMwSJFE.png?1

 

Link para o post
Compartilhar em outros sites
2 horas atrás, Comedinha disse:

@pauliinho157 Ali você autera a quantidade de items que é pego, e não quantos registra... Ao que parece você pode registrar infinitos items...

Obrigado por me informar :D, então vou testar o seu ultimo script, porque o meu ele começa normal pegando ai da uma quantia e começa a cair tudo no chão, vou testar já já edito e vejo falo sem funcionou.

É que eu sou novo nisso, ai estou aprendendo aos poucos :D

Criador, a procura de mapper e scripter para server de tibia 8.6 DEDICADO

 

| IP: real-world.servegame.com | XP: 650 | Baiak EDITED (PRÓPRIO) | DEDICADO 24horas Online | Aberto 10.12.15 |

logo.png

Link para o post
Compartilhar em outros sites
Spoiler
14 horas atrás, Comedinha disse:

Tenta assim, se não der desisto e.e

 



<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	local debugnumber = 0
	if ShowItemsTabble(cid, true) == false then
		debugnumber = 0
	elseif ShowItemsTabble(cid, true) == true then
		debugnumber = 1
	else
		debugnumber = ShowItemsTabble(cid, true)
	end
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and debugnumber > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and debugnumber > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local debugnumber = 0
if ShowItemsTabble(cid, true) == false then
	debugnumber = 0
elseif ShowItemsTabble(cid, true) == true then
	debugnumber = 1
else
	debugnumber = ShowItemsTabble(cid, true)
end
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and debugnumber >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and debugnumber >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

 

 

Continuou dando o mesmo problema, mas obrigado por tentar o/

 

Link para o post
Compartilhar em outros sites
1 minuto atrás, lucaspds disse:
  Ocultar conteúdo

 

Continuou dando o mesmo problema, mas obrigado por tentar o/

 

Cara, o meu está do mesmo jeito, mais verifica se você não errou algum script, vê se na distro não da erro após tentar usa-la.

Criador, a procura de mapper e scripter para server de tibia 8.6 DEDICADO

 

| IP: real-world.servegame.com | XP: 650 | Baiak EDITED (PRÓPRIO) | DEDICADO 24horas Online | Aberto 10.12.15 |

logo.png

Link para o post
Compartilhar em outros sites
8 minutos atrás, pauliinho157 disse:

Cara, o meu está do mesmo jeito, mais verifica se você não errou algum script, vê se na distro não da erro após tentar usa-la.

MAN, já testei, acontece o mesmo problema das imagens que mandei anteriormente, o script depois de modificado eu dou o comando /autoloot a lista aparece vazia, beleza

Dou o comando/autoloot add, sword Ele devolve falando que foi adicionando ao auto loot

dou novamente o comando /autoloot pra ver a lista e ele buga e da o erro da distro q ja mandei aqui no post... Se tento adicionar mais itens da o erro q mandei aqui no post... 

Estoou perdido uheuehueh

Link para o post
Compartilhar em outros sites
18 minutos atrás, lucaspds disse:

MAN, já testei, acontece o mesmo problema das imagens que mandei anteriormente, o script depois de modificado eu dou o comando /autoloot a lista aparece vazia, beleza

Dou o comando/autoloot add, sword Ele devolve falando que foi adicionando ao auto loot

dou novamente o comando /autoloot pra ver a lista e ele buga e da o erro da distro q ja mandei aqui no post... Se tento adicionar mais itens da o erro q mandei aqui no post... 

Estoou perdido uheuehueh

Assim, você tem que deletar os que você já fez e tenta refaze-lo com calma, pois havia o mesmo erro, mas esse ultimo do comedinha deu bom aqui... Tente deletando e refazendo novamente e me diz o que deu.

Criador, a procura de mapper e scripter para server de tibia 8.6 DEDICADO

 

| IP: real-world.servegame.com | XP: 650 | Baiak EDITED (PRÓPRIO) | DEDICADO 24horas Online | Aberto 10.12.15 |

logo.png

Link para o post
Compartilhar em outros sites
37 minutos atrás, pauliinho157 disse:

Cara, o meu está do mesmo jeito, mais verifica se você não errou algum script, vê se na distro não da erro após tentar usa-la.

Não funcionou, continua o mesmo problema.. Será q n é por conta de outra configuração? Nos talkations ou sl? Poderia me passar o seu sistema de autoloot  Paulinho? 

 

Link para o post
Compartilhar em outros sites
1 hora atrás, lucaspds disse:

Não funcionou, continua o mesmo problema.. Será q n é por conta de outra configuração? Nos talkations ou sl? Poderia me passar o seu sistema de autoloot  Paulinho? 

 

Posso sim.

Script:

Spoiler

<?xml version="1.0" encoding="ISO-8859-1"?>  
<mod name="Loot System" version="1.0" author="Vodkart And Mkalo" contact="none.com" enabled="yes">  
<config name="Loot_func"><![CDATA[

info = {
	FreeLimit = 4,
	PremiumLimit = 10,
	AutomaticDeposit = true,
	BlockMonsters = {},
	BlockItemsList = {2123,2515}
}


function setPlayerStorageTable(cid, storage, tab)
	local tabstr = "&"
	for i,x in pairs(tab) do
		tabstr = tabstr .. i .. "," .. x .. ";"
	end
	setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function getPlayerStorageTable(cid, storage)
	local tabstr = getPlayerStorageValue(cid, storage)
	local tab = {}
	if type(tabstr) ~= "string" then
		return {}
	end

	if tabstr:sub(1,1) ~= "&" then
		return {}
	end

	local tabstr = tabstr:sub(2, #tabstr)
	local a = string.explode(tabstr, ";")
	for i,x in pairs(a) do
		local b = string.explode(x, ",")
		tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
	end
	return tab
end


function isInTable(cid, item)
	for _,i in pairs(getPlayerStorageTable(cid, 27000))do
		if tonumber(i) == tonumber(item) then
			return true
		end
	end
	return false
end

function addItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	if x ~= 0 then
		table.insert(x,tonumber(item))
		setPlayerStorageTable(cid, 27000, x)
	else
		setPlayerStorageTable(cid, 27000, {item})
	end
end

function removeItemTable(cid, item)
	local x = {}
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		table.insert(x,getPlayerStorageTable(cid, 27000))
	end
	for i,v in ipairs(x) do
		if tonumber(v) == tonumber(item) then
			table.remove(x,i)
		end
	end
	return setPlayerStorageTable(cid, 27000, x)
end

function ShowItemsTabble(cid, value)
	local str,n = "-- My Loot List --\n\n",0
	for i = 1,#getPlayerStorageTable(cid, 27000) do
		n = n + 1
		str = str..""..n.." - "..getItemNameById(getPlayerStorageTable(cid, 27000)).."\n"
	end
	if value then
		return n
	end
	return doShowTextDialog(cid, 2529, str)
end

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)
				end
			else
				if itemid == item.itemid then
					table.insert(items, item.uid)
				end
			end
		end
	end
	return items
end

function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
	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 AutomaticDeposit(cid,item,n)
	local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n*1)
	return doPlayerDepositMoney(cid, deposit)
end

function corpseRetireItems(cid, pos)
	local check = false
	for i = 0, 255 do
		pos.stackpos = i
		tile = getTileThingByPos(pos)
		if tile.uid > 0 and isCorpse(tile.uid) then
			check = true
			break
		end
	end
	if check == true then
		local items = getContainerItems(tile.uid)
		for i,x in pairs(items) do
			if isInArray(getPlayerStorageTable(cid, 27000), tonumber(x.itemid)) then
				if isItemStackable(x.itemid) then
					doPlayerAddItemStacking(cid, x.itemid, x.type)
					if info.AutomaticDeposit == true and isInArray({"2148","2152","2160"},tonumber(x.itemid)) then
						AutomaticDeposit(cid,x.itemid,x.type)
					end
				else
					doPlayerAddItem(cid, x.itemid)
				end
				doRemoveItem(x.uid)
			end
		end
	end
end]]></config>

<event type="login" name="LootLogin" event="script"><![CDATA[

function onLogin(cid)
	local debugnumber = 0
	if ShowItemsTabble(cid, true) == false then
		debugnumber = 0
	elseif ShowItemsTabble(cid, true) == true then
		debugnumber = 1
	else
		debugnumber = ShowItemsTabble(cid, true)
	end
	registerCreatureEvent(cid, "MonsterAttack")
	if isPremium(cid) and debugnumber > info.PremiumLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error, you autoloot has been reseted")
	elseif not isPremium(cid) and debugnumber > info.FreeLimit then
		setPlayerStorageValue(cid, 27000, -1)
		doPlayerSendCancel(cid, "Error/Premium is out, you autoloot has been reseted")
	end
	return true
end]]></event>

<event type="death" name="LootEventDeath" event="script"><![CDATA[

domodlib('Loot_func')
function onDeath(cid, corpse, deathList)
	local killer,pos = deathList[1],getCreaturePosition(cid)
	addEvent(corpseRetireItems,1,killer,pos)
	return true
end]]></event>

<event type="combat" name="MonsterAttack" event="script"><![CDATA[

domodlib('Loot_func')
if isPlayer(cid) and isMonster(target) and not isInArray(info.BlockMonsters,string.lower(getCreatureName(target))) then
	registerCreatureEvent(target, "LootEventDeath")
end
return true]]></event>

<talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[

domodlib('Loot_func')
local debugnumber = 0
if ShowItemsTabble(cid, true) == false then
	debugnumber = 0
elseif ShowItemsTabble(cid, true) == true then
	debugnumber = 1
else
	debugnumber = ShowItemsTabble(cid, true)
end
local t = string.explode(string.lower(param), ",")
if not t[1] then
	ShowItemsTabble(cid, false)
	return true
elseif tonumber(t[1]) or tonumber(t[2]) then
	doPlayerSendCancel(cid, "enter!autoloot add,name or !autoloot remove,name")
	return true
elseif isInArray({"add","remove"}, tostring(t[1])) then
	local func,check = tostring(t[1]) == "add" and addItemTable or removeItemTable, tostring(t[1]) == "add" and true or false
	local item = getItemIdByName(tostring(t[2]), false)
	if not item then
		doPlayerSendCancel(cid, "This item does not exist.")
		return true
	elseif check == true and isInArray(info.BlockItemsList, item) then
		doPlayerSendCancel(cid, "You can not add this item in the list!")
		return true
	elseif isInTable(cid, item) == check then
		doPlayerSendCancel(cid, "This Item "..(check == true and "already" or "is not").." in your list.")
		return true
	elseif isPremium(cid) and debugnumber >= info.PremiumLimit then
		doPlayerSendCancel(cid, "Only "..info.PremiumLimit.." items for you.")
		return true
	elseif not isPremium(cid) and debugnumber >= info.FreeLimit then
		doPlayerSendCancel(cid, "Only "..info.FreeLimit.." items for free accounts.")
		return true
	end
	func(cid, item)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,check == true and "you added the item "..t[2].." in the list" or "you removed the item "..t[2].." from the list") return true
end
return true]]></talkaction>
</mod>

@EDIT: Se não der retira os numeros, deixe assim blockItemList = {}

 

@Comedinha Pode me ajudar, começou tudo ótimo o script, mas ele começa a derrubar os itens no chão, como eu arrumo isso, já testei varios scripts :\

Editado por pauliinho157 (veja o histórico de edições)

Criador, a procura de mapper e scripter para server de tibia 8.6 DEDICADO

 

| IP: real-world.servegame.com | XP: 650 | Baiak EDITED (PRÓPRIO) | DEDICADO 24horas Online | Aberto 10.12.15 |

logo.png

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 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 Naze
      Uns dos problemas das maiorias dos otserv casual que estão online é o autoloot, alguns com erros e defeito na checagem dos containers e sempre consumindo muito por ser em lua fazendo checagens de tile, corpo, itens e etc. Por isso decidi da uma contribuição a essa comunidade que me evoluiu bastante um autoloot diretamente na source na função que insere os itens no corpo, otimizando em 100% na hr da entrega do item, e não tendo problemas ocasionais como corpos sobre corpos ou varias bags.
       
           Esse sistema já é bem comum quando comprado, mas gratuito acredito que ainda não tinha disponível, então fiz esse totalmente do 0 na source tfs 0.4 rev 3999 (do yan).
          
          Atenção na instalação! Qualquer problema pra compilar que envolva as linhas presente no código verifique novamente se instalou corretamente antes de pedir ajuda para evitar flood. Qualquer bug, erro ou mal funcionamento encontrado pode postar que estarei corrigindo, mas não irei customizar a seu agrado, você consegue fazer isso sozinho com atenção e calma, e se precisa de ajuda é só posta as duvidas.
       
      Imagens do Sistema:
       
      Características: 
      -> Otimizado executando apenas funções necessarias -> Comandos simples e praticos -> !autoloot on/off //Autoloot estara sempre ligado, e caso queria desliga use '!autoloot off' -> !autoloot bank/bag //Define para onde ira o dinheiro coletado, direto banco ou no inventario -> !autoloot list //Lista todos itens adicionados para coleta -> !autoloot clear/clean //Remove todos itens da lista -> !autoloot add, name item, name item, ... //Adiciona itens na lista, podendo adicionar quantos quiser de uma vez. Ele retorna um messagem dizendo os itens que foram adicionados e os que deram erro e não foram adicionados, talvez por escrito errado, ja existente na lista, na lista de bloquados, etc. -> !autoloot remove, item name, item name, ... //Remove itens da lista, com a mesma logica do add. -> Opções configuravel pelo Config.lua -> AutoLoot_MoneyIDs //IDs dos Itens Moedas do servidor como gold coins, platinium coins, crystal coins. -> AutoLoot_BlockIDs //IDs dos itens bloqueados para autoloot -> AutoLoot_MaxItem //Quantidade maxima de itens para adicionar a lista -> Sistema livres de bugs ou logs de erros.  
      Instalação:
      Toda instalação será feita na source, exceto por 1 linha em talkactions.xml e 3 variáveis no config.lua
       
      TFS 0.4 :
       
      Link para Otx -> https://tibiaking.com/forums/topic/101086-otimizado-autoloot-in-sources-for-otx2-ou-menor/
       
      Nas versões atual da TFS para servidores 10+ não ira funcionar pois algumas funções são diferente e não irei corrigir agora, em breve passo o mesmo pra tfs 1.x e otx3.
       
      Esse sistema foi totalmente feito por mim, mas dou créditos também ao @Mathias Kenfi por me ajudar muito na evolução em lua/c++ e a tabela sql é a mesma usada no quick autoloot 1.3 postado por Pedriinz
       
      @Edit: 
      Quem usa source de derivados caso ocorra erro aplica as alterações dos comentários abaixo.
      Pequena correção em talkactions.cpp na parte remove na linha if(!player->checkAutoLoot(itemId)), para if(player->checkAutoLoot(itemId))
    • 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...
    • Por Digoshow
      Ola eu instalei um scrip no meu otserv que e o Auto-loot, tudo certinho blz, mais eu queria editar o comando que e usado para diciona um item, o comando que esta e esse /aloot remove:2170 eu queria deixa assim /aloot remove, 2170 tirar os 2 pontos e deixa uma virgula e um espaco depois da virgula, alguem consegue editar pra mim porfavor:
      Scrip que estou usando : http://www.tibiaking.com/forum/topic/8172-sistema-auto-loot/
      Obrigado, REP+ !
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo