Ir para conteúdo
  • Cadastre-se

Posts Recomendados

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

Spoiler

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

 

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

Cluck!

Link para o post
Compartilhar em outros sites

Sem duvida o melhor System de Auto Loot Danyel, parabens por atualizar o script e deixa-lo funcional, vai ajudar muita gente! REP+!

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites

Você adicionar o arquivo Auto_Loot.lua em data/lib?

Qual versão do seu TFS?

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites
3 horas atrás, Digoshow disse:

Você adicionar o arquivo Auto_Loot.lua em data/lib?

Qual versão do seu TFS?

0.3.6 , coloquei sim na pasta lib corretamente

Editado por leozincorsair (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
50 minutos atrás, leozincorsair disse:

0.3.6 , coloquei sim na pasta lib corretamente

@Danyel Varejao verifica se está certo o script lib lá rs...

 

@topic

 

Amigo tente trocar a sua lib por este:

Spoiler

function warnPlayersWithStorage(storage, value, class, message)
    if not value then value = 1 end
    if not class then class = MESSAGE_SATUS_CONSOLE_WARNING end
    if not storage or not message then return end
    if #getPlayersOnline() == 0 then
        return
    end
    for _, pid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(pid, storage) == value then
            doPlayerSendTextMessage(pid, class, message)
        end
    if getPlayerAccess(pid) >= 4 then    
        doPlayerSendTextMessage(pid, class, "Message to those with storage "..storage..message) -- Gms will always receive the messages
    end
    end
end

function getPlayerStorageZero(cid, storage)
    local sto = getPlayerStorageValue(cid, storage)
    return sto > 0 and sto or 0
end

function getStorageZero(storage) -- By Killua
    local sto = getGlobalStorageValue(storage)
    return sto > 0 and sto or 0
end

function countTable(table) -- By Killua
    local y = 0
    if type(table) == "table" then
        for _ in pairs(table) do
            y = y + 1
        end
        return y
    end
    return false
end

function getPlayersInArea(frompos, topos)
    local players_ = {}
    local count = 1
    for _, pid in pairs(getPlayersOnline()) do
        if isInArea(getCreaturePosition(pid), frompos, topos) then
            players_[count] = pid
            count = count + 1
        end
    end
    return countTable(players_) > 0 and players_ or false
end

function getGuildNameById(gid) -- By Killua
    local query = db.getResult("SELECT `name` FROM `guilds` WHERE `id` = '"..gid.."'")
    if query:getID() == -1 then
        return ""
    end
    local name = query:getDataString("name")
    query:free()
    return name
end

function getContainerItemsInfo(containerUid)
    local table = {}
    if containerUid and containerUid > 0 then
        local a = 0   
        for i = 0, getContainerSize(containerUid) - 1 do
            local item = getContainerItem(containerUid,i)
            a = a + 1
            table[a] = {uid = item.uid, itemid = item.itemid, quant = item.type}
        end
        return table
    end
    return false
end

function getTableEqualValues(table)
    local ck = {}
    local eq = {}
    if type(table) == "table" then
          if countTable(table) and countTable(table) > 0 then
               for i = 1, countTable(table) do
                 if not isInArray(ck, table) then
                    ck = table
                else
                    eq = table
                end
            end
            return countTable(eq) > 0 and eq or 0
        end
    end
    return false
end

function killuaGetItemLevel(uid)
    local name = getItemName(uid)
    local pos = 0
    for i = 1, #name do
        if string.byte(name:sub(i,i)) == string.byte('+') then
            pos = i + 1
            break
        end
    end
    return tonumber(name:sub(pos,pos))
end

k_table_storage_lib = {
    filtrateString = function(str)
        local tb, x, old, last = {}, 0, 0, 0
        local first, second, final = 0, 0, 0
        if type(str) ~= "string" then
            return tb
        end
        for i = 2, #str-1 do
            if string.byte(str:sub(i,i)) == string.byte(':') then
                x, second, last = x+1, i-1, i+2
                for t = last,#str-1 do
                    if string.byte(str:sub(t,t)) == string.byte(',') then
                        first = x == 1 and 2 or old
                        old, final = t+2, t-1
                        local index, var = str:sub(first,second), str:sub(last,final)
                        tb[tonumber(index) or tostring(index)] = tonumber(var) or tostring(var)
                        break
                    end
                end
            end
        end
        return tb
    end,

    translateIntoString = function(tb)
        local str = ""
        if type(tb) ~= "table" then
            return str
        end
        for i, t in pairs(tb) do
            str = str..i..": "..t..", "
        end
        str = "a"..str.."a"
        return tostring(str)
    end
}

function setPlayerTableStorage(cid, key, value)
    return doPlayerSetStorageValue(cid, key, k_table_storage_lib.translateIntoString(value))
end

function getPlayerTableStorage(cid, key)
    return k_table_storage_lib.filtrateString(getPlayerStorageValue(cid, key))
end

function setGlobalTableStorage(key, value)
    return setGlobalStorageValue(key, k_table_storage_lib.translateIntoString(value))
end

function getGlobalTableStorage(key)
    return k_table_storage_lib.filtrateString(getGlobalStorageValue(key))
end

function printTable(table, includeIndices,prnt)
    if includeIndices == nil then includeIndices = true end
    if prnt == nil then prnt = true end
    if type(table) ~= "table" then
        error("Argument must be a table")
        return
    end
    local str, c = "{", ""
    for v, b in pairs(table) do
        if type(b) == "table" then
            str = includeIndices and str..c.."["..v.."]".." = "..printTable(b,true,false) or str..c..printTable(b,false,false)
        else
            str = includeIndices and str..c.."["..v.."]".." = "..b or str..c..b
        end
        c = ", "
    end
    str = str.."}"
    if prnt then print(str) end
    return str
 end
 
function checkString(str)
    local check = true
    for i = 1, #str do
        local letra = string.byte(str:sub(i,i))
        if letra >= string.byte('a') and letra <= string.byte('z') or letra >= string.byte('A') and letra <= string.byte('Z') or letra >= string.byte('0') and letra <= string.byte('9') then
            check = true
        else
            check = false
            break
        end
    end
    return check
end

 

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites
17 horas atrás, leozincorsair disse:

Não esta coletando os golds e aparece esses erros :

 

 

1.png

 

Provavelmente você não deve ter instalado corretamente ou não é compatível com TFS 0.3.6, tenta instalar mais uma vez ou tenta mudar de distro pra ver.

Link para o post
Compartilhar em outros sites
16 horas atrás, leozincorsair disse:

o dinheiro vai para o banker ? pois esta indo e vai errado tipo as vezes vai valores maiores e outros menores , meio estranho .

Sim o dinheiro vai pro banco, tem certeza cara? :S

Link para o post
Compartilhar em outros sites
13 minutos atrás, Danyel Varejao disse:

Sim o dinheiro vai pro banco, tem certeza cara? :S

Tenho cara o balance quando uso !autoloot goldinfo diz um tanto , agora quando vou para o banco e olho tem outro valor.

 

Link para o post
Compartilhar em outros sites
  • 3 months later...
Em 02/07/2017 em 07:58, Danyel Varejao disse:

~~~~~ * Auto Loot System 100% * ~~~~~ TFS 0.4 / TFS 0.3.7

Fala galerinha do Tibiaking, então, várias pessoas estão tendo problema com o sistema de autoloot, aqui vai um sistema que eu editei para melhorar o uso do mesmo. Sem muita enrolação vamos ao que interessa.

 

1° - Acesse a pasta data/lib e crie um arquivo chamado Auto_Loot.lua, coloque isso dentro do arquivo:

 

  Mostrar conteúdo oculto


--[[
	Auto Loot System by Danyel Varejão
]]

AutoLoot = {
	Min_Level = 100, -- Level minimo pra utilizar o auto loot.
	Max_Slots = 5, -- Máximo de slots permitidos.
	Boost_Actived = true,
	
	-- Nao mexa daqui pra baixo caso nao entenda --
	Storage_Boost = 45000,
	Storage_On_Items = 45001,
	Storage_On_Gold = 45002,
	Storages = {
		Count_Gold = 45003,
		Count_Items = 45004,
		Count_Table = 45005,
		Slots = {45006, 45007, 45008, 45009, 45010} -- Storage pra cada slot.
	}
}

AutoLoot_Boost = {
	-- [ID do item] = Valor,
	[2406] = 36, 
	[2537] = 4800, 
	[2377] = 480, 
	[2663] = 600, 
	[2472] = 240000, 
	[2398] = 36, 
	[2475] = 7200, 
	[2519] = 6000, 
	[2497] = 10800, 
	[2523] = 180000, 
	[2494] = 108000, 
	[2400] = 144000, 
	[2491] = 6000, 
	[2421] = 108000, 
	[2646] = 240000, 
	[2477] = 7200, 
	[2413] = 84, 
	[2656] = 18000, 
	[2498] = 48000, 
	[2647] = 600, 
	[2534] = 30000, 
	[7402] = 24000, 
	[2466] = 36000, 
	[2465] = 240, 
	[2408] = 120000, 
	[2518] = 1800, 
	[2500] = 3000, 
	[2376] = 30, 
	[2470] = 96000, 
	[2388] = 24, 
	[2645] = 48000, 
	[2434] = 2400, 
	[2463] = 480, 
	[2536] = 9600, 
	[2387] = 240, 
	[2396] = 4800, 
	[2381] = 240, 
	[2528] = 4800, 
	[2409] = 1800, 
	[2414] = 12000, 
	[2427] = 9000, 
	[2407] = 7200, 
	[2458] = 42, 
	[2383] = 960, 
	[2392] = 3600, 
	[2488] = 18000, 
	[2525] = 120, 
	[2423] = 240, 
	[2462] = 4800, 
	[2520] = 48000, 
	[2390] = 180000, 
	[2417] = 72, 
	[2436] = 1200, 
	[5741] = 42000, 
	[2378] = 120, 
	[2487] = 24000, 
	[2476] = 6000,
	[8891] = 36000, 
	[2459] = 36, 
	[2195] = 48000, 
	[2391] = 7200, 
	[2464] = 120, 
	[8889] = 72000, 
	[2432] = 12000, 
	[2431] = 108000, 
	[2492] = 72000, 
	[2515] = 240, 
	[2430] = 2400, 
	[2393] = 12000, 
	[7419] = 36000, 
	[2522] = 120000, 
	[2514] = 180000
}

function AutoLoot.CountTable(table)
    local Count = 0
    if type(table) == "table" then
        for index in pairs(table) do
            Count = Count + 1
        end
        return Count
    end
    return false
end

function AutoLoot.getContainerItemsInfo(ContainerUID)
    local Table = {}
    if ContainerUID and ContainerUID > 0 then
        local Index = 0   
        for i = 0, getContainerSize(ContainerUID) - 1 do
            local item = getContainerItem(ContainerUID, i)
            Index = Index + 1
            Table[Index] = {UID = item.uid, ItemID = item.itemid, Count = item.type}
        end
        return Table
    end
    return false
end

function AutoLoot.String(String)
	local Table = {}
	local x, old, last = 0, 0, 0
	local first, second, final = 0, 0, 0
	if type(String) ~= "string" then
		return Table
	end
	for i = 2, #String - 1 do
		if string.byte(String:sub(i,i)) == string.byte(':') then
			x, second, last = x + 1, i - 1, i + 2
			for t = last, #String - 1 do
				if string.byte(String:sub(t,t)) == string.byte(',') then
					first = x == 1 and 2 or old
					old, final = t + 2, t - 1
					local Index = String:sub(first, second)
					local Var = String:sub(last, final)
					Table[tonumber(Index) or tostring(Index)] = tonumber(Var) or tostring(Var)
					break
				end
			end
		end
	end
	return Table
end

function AutoLoot.TranslateString(Table)
	local String = ""
	if type(Table) ~= "table" then
		return String
	end
	for i, last in pairs(Table) do
		String = String..i..": ".. last ..", "
	end
	String = "a"..String.."a"
	return tostring(String)
end

function AutoLoot.getPlayerStorageZero(cid, key)
    return getPlayerStorageValue(cid, key) > 0 and getPlayerStorageValue(cid, key) or 0
end

function AutoLoot.getStorageZero(key)
    return getGlobalStorageValue(key) > 0 and getGlobalStorageValue(key) or 0
end

function AutoLoot.setPlayerTableStorage(cid, key, value)
	return doPlayerSetStorageValue(cid, key, AutoLoot.TranslateString(value))
end

function AutoLoot.setGlobalTableStorage(key, value)
	return setGlobalStorageValue(key, AutoLoot.TranslateString(value))
end

function AutoLoot.getPlayerTableStorage(cid, key)
	return AutoLoot.String(getPlayerStorageValue(cid, key))
end

function AutoLoot.getGlobalTableStorage(key)
	return AutoLoot.String(getGlobalStorageValue(key))
end

function AutoLoot.getPlayerList(cid)
	local Table = {}
	for i = 1, #AutoLoot.Storages.Slots do
		if getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i]) ~= -1 then
			table.insert(Table, getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i]))
		end
	end
	if #Table > 0 then
		return Table
	end
	return false
end

function AutoLoot.ExistItemByName(name)
	local Items = io.open("data/items/items.xml", "r"):read("*all")
	local GetITEM = Items:match('name="' .. name ..'"')
	if GetITEM == nil or GetITEM == "" then
		return false
	end
	return true
end

function AutoLoot.addToList(cid, name)
	local ItemID = getItemIdByName(name)
	if AutoLoot.getPlayerList(cid) and isInArray(AutoLoot.getPlayerList(cid), ItemID) then
		return false
	end
	for i = 1, #AutoLoot.Storages.Slots do
		if getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i]) == -1 then
			doPlayerSetStorageValue(cid, AutoLoot.Storages.Slots[i], ItemID)
			return true
		end
	end
end

function AutoLoot.removeFromList(cid, name)
	local ItemID = getItemIdByName(name)
	for i = 1, #AutoLoot.Storages.Slots do
		if getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i]) == ItemID then
			doPlayerSetStorageValue(cid, AutoLoot.Storages.Slots[i], -1)
			return true
		end
	end
	return false
end

function AutoLoot.Boost(cid)
	return tonumber(getPlayerStorageValue(cid, AutoLoot.Storage_Boost)) >= os.time()
end

function AutoLoot.Items(cid, position)
	if not isPlayer(cid) then 
		return true
	end
	local Check, String, Position = false, "", {}
	for i = 1, 255 do
		position.stackpos = i
		if getThingFromPos(position).uid and getThingFromPos(position).uid > 0 and isContainer(getThingFromPos(position).uid) then
			Position = position
			Check = true
			break
		end
	end
	if Check then
		local CorpseUID = AutoLoot.getContainerItemsInfo(getThingFromPos(Position).uid)		
		if CorpseUID then
			for Index, Item in pairs(CorpseUID) do
				if Index < AutoLoot.CountTable(CorpseUID) then
					if Item.UID and Item.ItemID then
						if isContainer(Item.UID) then
							local Bag = AutoLoot.getContainerItemsInfo(Item.UID)
							for i = 1, AutoLoot.CountTable(Bag) do
								if isInArray(AutoLoot.getPlayerList(cid), Bag[i].ItemID) then
									if Bag[i].Count > 1 then
										doRemoveItem(Bag[i].uid, Bag[i].Count)
										doPlayerAddItem(cid, Bag[i].ItemID, Bag[i].Count)
										String = String.." ".. Bag[i].Count .." ".. getItemNameById(Bag[i].ItemID) .." +"
									else
										doRemoveItem(Bag[i].uid)
										if AutoLoot.Boost_Actived and AutoLoot.Boost(cid) then
											if AutoLoot_Boost[Bag[i].ItemID] then
												doPlayerSetBalance(cid, getPlayerBalance(cid) + AutoLoot_Boost[Bag[i].ItemID])
												String = String.." 1 ".. getItemNameById(Bag[i].ItemID) .." (".. AutoLoot_Boost[Bag[i].ItemID] .."gp no banco) +"
											else
												doPlayerAddItem(cid, Bag[i].ItemID, 1)
												String = String.." 1 ".. getItemNameById(Bag[i].ItemID) .." +"
											end
										else
											doPlayerAddItem(cid, Bag[i].ItemID, 1)
											String = String.." 1 ".. getItemNameById(Bag[i].ItemID) .." +"
										end
									end
								end
							end
						end
					end
				end
				if isInArray(AutoLoot.getPlayerList(cid), Item.ItemID) then
					if Item.Count > 1 then
						doRemoveItem(Item.UID, Item.Count)
						doPlayerAddItem(cid, Item.ItemID, Item.Count)
						String = String.." ".. Item.Count .." ".. getItemNameById(Item.ItemID) .." +"
					else
						doRemoveItem(Item.UID)
						if AutoLoot.Boost_Actived and AutoLoot.Boost(cid) then
							if AutoLoot_Boost[Item.ItemID] then
								doPlayerSetBalance(cid,getPlayerBalance(cid) + AutoLoot_Boost[Item.ItemID])
								String = String.." 1 "..getItemNameById(Item.ItemID).." ("..AutoLoot_Boost[Item.ItemID].."gps no banco) +"
							else
								doPlayerAddItem(cid, Item.ItemID, 1)
								String = String.." 1 "..getItemNameById(Item.ItemID).." +"
							end
						else
							doPlayerAddItem(cid, Item.ItemID, 1)
							String = String.." 1 "..getItemNameById(Item.ItemID).." +"
						end
					end
				end
			end
		end
	end
	AutoLoot.setPlayerTableStorage(cid, AutoLoot.Storages.Count_Table, {[1] = String, [2] = 0})
end

function AutoLoot.Gold(cid, position)
	if not isPlayer(cid) then 
		return true 
	end
	local Check = false
	local Total_Gold = 0
	local Position = {}
	for i = 1, 255 do
		position.stackpos = i
		if getThingFromPos(position).uid and getThingFromPos(position).uid > 0 and isContainer(getThingFromPos(position).uid) then
			Position = position
			Check = true
			break
		end
	end
	if Check then
		local CorpseUID = AutoLoot.getContainerItemsInfo(getThingFromPos(Position).uid)
		if CorpseUID then
			for Index, Item in pairs(CorpseUID) do
				if Item.UID and Item.ItemID then
					if Index < AutoLoot.CountTable(CorpseUID) then
						if isContainer(Item.UID) then
							local Bag = AutoLoot.getContainerItemsInfo(Item.UID)
							for i = 1, AutoLoot.CountTable(Bag) do
								if isInArray({2148, 2152, 2160}, Bag[i].ItemID) then
									local Multiplier = 1
									if Bag[i].ItemID == 2148 then
										Multiplier = 1
									elseif Bag[i].ItemID == 2152 then
										Multiplier = 100
									elseif Bag[i].ItemID == 2160 then
										Multiplier = 10000
									end
									doRemoveItem(Bag[i].uid, Bag[i].Count)
									doPlayerSetBalance(cid, getPlayerBalance(cid) + tonumber(Bag[i].Count) * Multiplier)
									Total_Gold = Total_Gold + Bag[i].Count * Multiplier
									doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Gold, tonumber(AutoLoot.getPlayerStorageZero(cid, AutoLoot.Storages.Count_Gold)) + tonumber(Item.Count) * tonumber(Multiplier))
								end
							end
						end
					end
					if isInArray({2148, 2152, 2160}, Item.ItemID) then
						local Multiplier = 1
						if Item.ItemID == 2148 then
							Multiplier = 1
						elseif Item.ItemID == 2152 then
							Multiplier = 100
						elseif Item.ItemID == 2160 then
							Multiplier = 10000
						end
						doRemoveItem(Item.UID, Item.Count)
						doPlayerSetBalance(cid, getPlayerBalance(cid) + Item.Count * Multiplier)
						doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Gold, tonumber(AutoLoot.getPlayerStorageZero(cid, AutoLoot.Storages.Count_Gold)) + tonumber(Item.Count) * tonumber(Multiplier))
						Total_Gold = Total_Gold + Item.Count * Multiplier
					end
				end
			end
		end
	end
	if Total_Gold > 0 then
		Total_Gold = Total_Gold - (Total_Gold * 0.2) 
		Total_Gold = math.ceil(Total_Gold)
		doPlayerSetBalance(cid, getPlayerBalance(cid) + Total_Gold)
		local Table = AutoLoot.getPlayerTableStorage(cid, AutoLoot.Storages.Count_Table)
		Table[2] = Total_Gold
		AutoLoot.setPlayerTableStorage(cid, AutoLoot.Storages.Count_Table, Table)
	end
end

function AutoLoot.Message(cid)
	if not isPlayer(cid) then 
		return true
	end
	local Table = AutoLoot.getPlayerTableStorage(cid, AutoLoot.Storages.Count_Table)
	if AutoLoot.CountTable(Table) >= 1 then
		if Table[1] then
			if Table[2] and Table[2] > 0 then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: ".. Table[1] .." ".. Table[2] .." gold coins.")
			else
				if type(Table[1]) == "string" and string.len(Table[1]) > 1 then
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: "..Table[1])
				end
			end
		elseif not Table[1] then
			if Table[2] then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "[Auto Loot System] Coletados: "..Table[2].." gold coins.")
			end
		end
	end
	doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Table, -1)
end

 

 

2° - Abra a pasta data/actions/scripts e crie um arquivo chamado Auto_Loot_Boost.lua, dentro dele adicione:

 

  Mostrar conteúdo oculto


--[[
	Auto Loot System by Danyel Varejão
]]

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if AutoLoot.Boost(cid) then
		doPlayerSendCancel(cid, "Você já está com o BOOST ativado!")
		return true
	end
    if doRemoveItem(item.uid) then
    	doPlayerSetStorageValue(cid, AutoLoot.Storage_Boost, os.time() + 3600 * 24)
    	doSendMagicEffect(getThingPos(cid), 49)
    	doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você ativou o Auto Loot BOOST por mais 24 horas. Durante esse tempo os itens coletados serão vendidos automaticamente e o dinheiro será depositado no seu banco.")
    end
    return true
end

 

 

3° - Abra a pasta data/creaturescripts/scripts e crie um arquivo chamado Auto_Loot.lua, dentro dele adicione:

 

  Mostrar conteúdo oculto


--[[
	Auto Loot System by Danyel Varejão
	Created in 02/07/2017
]]

function onLogin(cid)
	registerCreatureEvent(cid, "Auto_Loot_Login")
	registerCreatureEvent(cid, "Auto_Loot_Kill")
	return true
end

function onKill(cid, target, lastHit)
	if isPlayer(cid) and isMonster(target) then
		if getPlayerStorageValue(cid, AutoLoot.Storage_On_Items) == 1 and #AutoLoot.getPlayerList(cid) > 0 then
			addEvent(AutoLoot.Items, 500, cid, getCreaturePosition(target))
		end
		if getPlayerStorageValue(cid, AutoLoot.Storage_On_Gold) == 1 then
			addEvent(AutoLoot.Gold, 500, cid, getCreaturePosition(target))
		end
		if getPlayerStorageValue(cid, AutoLoot.Storage_On_Items) == 1 or getPlayerStorageValue(cid, AutoLoot.Storage_On_Gold) == 1 then
			addEvent(AutoLoot.Message, 500, cid)
		end
	end
	return true
end

 

 

4° - Abra a pasta data/talkactions/scripts e crie um arquivo chamado Auto_Loot.lua, dentro dele adicione:

 

  Mostrar conteúdo oculto


function onSay(cid, words, param)
	if param == "" then
		local String = ""
		local Slot_Count = 1
		for i = 1, #AutoLoot.Storages.Slots do
			if getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i]) ~= -1 then
				String = String.."{Auto-Loot} --- Slot "..Slot_Count..": "..getItemNameById(getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i])).."\n"
			else
				String = String.."{Auto-Loot} --- Slot "..Slot_Count..": Empty\n"
			end
			Slot_Count = Slot_Count + 1
		end
		local Gold_Status = getPlayerStorageValue(cid, AutoLoot.Storage_On_Gold) == 1 and "on" or "off"
		local Items_Status = getPlayerStorageValue(cid, AutoLoot.Storage_On_Items) == 1 and "on" or "off"
		doPlayerPopupFYI(cid, [[
{Auto-Loot} --- Coletar dinheiro: ]].. Gold_Status ..[[. Para ligar/desligar: !autoloot gold
{Auto-Loot} --- Coletar itens únicos: ]].. Items_Status ..[[. Para ligar/desligar: !autoloot power
{Auto-Loot} --- Configuração dos slots:
]].. String ..[[
{Auto-Loot} --- Para adicionar um novo item aos slots: !autoloot add, <nome do item>
{Auto-Loot} --- Para retirar um item dos slots: !autoloot remove, <nome do item>
{Auto-Loot} --- Para limpar todos os slots utilize: !autoloot clear
{Auto-Loot} --- Para informações de quanto você já fez utilizando a coleta de dinheiro, use: !autoloot goldinfo
{Auto-Loot} --- Se seu autoloot bugar use !autoloot desbug
]])
		return true
	end
	
	local CommandParam = string.explode(param, ",")
	if getPlayerLevel(cid) >= AutoLoot.Min_Level then
		if CommandParam[1] == "power" then
			local get_Items = getPlayerStorageValue(cid, AutoLoot.Storage_On_Items) == -1 and "ligou" or "desligou"
			doPlayerSetStorageValue(cid, AutoLoot.Storage_On_Items, getPlayerStorageValue(cid, AutoLoot.Storage_On_Items) == -1 and 1 or -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você "..get_Items.." o auto loot.")
		elseif CommandParam[1] == "gold" then
			local get_Gold = getPlayerStorageValue(cid, AutoLoot.Storage_On_Gold) == -1 and "ligou" or "desligou"
			doPlayerSetStorageValue(cid, AutoLoot.Storage_On_Gold, getPlayerStorageValue(cid, AutoLoot.Storage_On_Gold) == -1 and 1 or -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você "..get_Gold.." a coleta de dinheiro.")
			doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Gold, 0)
		elseif CommandParam[1] == "goldinfo" then
			local Check_Gold_Info = getPlayerStorageValue(cid, AutoLoot.Storage_On_Gold) == -1 and "O sistema de coleta de dinheiro está desligado" or "O sistema já coletou "..AutoLoot.getPlayerStorageZero(cid, AutoLoot.Storages.Count_Gold).." gold coins"
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, Check_Gold_Info)
		elseif CommandParam[1] == "add" then
			if CommandParam[2] ~= nil and CommandParam[2] ~= "" and AutoLoot.ExistItemByName(CommandParam[2]) then
				local Item = getItemIdByName(CommandParam[2])
				if isInArray({2160, 2148, 2152}, Item) then
					return doPlayerSendCancel(cid, "Você não pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold")
				end
				if getPlayerStorageValue(cid, AutoLoot.Storages.Count_Items) < (AutoLoot.Max_Slots - 1) then
					if AutoLoot.addToList(cid, CommandParam[2]) then
						doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Items, getPlayerStorageValue(cid, AutoLoot.Storages.Count_Items) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, CommandParam[2].." adicionado à sua lista do auto loot! Para ver sua lista diga !autoloot list")
					else
						doPlayerSendCancel(cid, CommandParam[2].." já está em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Sua lista já tem ".. AutoLoot.Max_Slots .." itens! Você deve remover algum antes de adicionar outro.")
				end
			else
				doPlayerSendCancel(cid, "Este item não existe!")
			end
		elseif CommandParam[1] == "remove" then
			if CommandParam[2] ~= nil and CommandParam[2] ~= "" and AutoLoot.ExistItemByName(CommandParam[2]) then
				if AutoLoot.removeFromList(cid, CommandParam[2]) then
					doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Items, getPlayerStorageValue(cid, AutoLoot.Storages.Count_Items) - 1)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, CommandParam[2].." removido da sua lista do auto loot!")
				else
					doPlayerSendCancel(cid, "Este item não está na sua lista!")
				end
			else
				doPlayerSendCancel(cid, "Este item não existe!")
			end
		elseif CommandParam[1] == "clear" then
			if getPlayerStorageValue(cid, AutoLoot.Storages.Count_Items) > -1 then
				doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Items, -1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!")
				for i = 1, #AutoLoot.Storages.Slots do 
					doPlayerSetStorageValue(cid, AutoLoot.Storages.Slots[i], -1)
				end
			else
				doPlayerSendCancel(cid, "Sua lista ja esta limpa!")
			end
		elseif CommandParam[1] == "desbug" or CommandParam[1] == "desbugar" then
			doPlayerSetStorageValue(cid, AutoLoot.Storages.Count_Items, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!")
			for i = 1, #AutoLoot.Storages.Slots do 
				doPlayerSetStorageValue(cid, AutoLoot.Storages.Slots[i], -1)
			end
		elseif CommandParam[1] == "list" then
			local String = ""
			local Slot_Count = 1
			for i = 1, #AutoLoot.Storages.Slots do
				if getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i]) ~= -1 then
					String = String.."Slot "..Slot_Count..": "..getItemNameById(getPlayerStorageValue(cid, AutoLoot.Storages.Slots[i])).."\n"
				else
					String = String.."Slot "..Slot_Count..": Empty\n"
				end
				Slot_Count = Slot_Count + 1
			end
			doPlayerPopupFYI(cid, [[
---------{Auto-Loot}---------
O sistema auto loot está coletando:

]].. String ..[[
]])
		end
	else
		doPlayerSendCancel(cid, "Você não é level maior que "..AutoLoot.Min_Level.." para utilizar este comando.")
	end
	return true
end

 

 

5° - Em data/actions/actions.xml adicione a seguinte tag:

 


<!-- Auto Loot -->
<action itemid="7443" event="script" value="Auto_Loot_Boost.lua"/>

Altere o numero 7443 caso queira mudar o id do item do seu auto loot boost.

 

6° - Em data/creaturescripts/creaturescripts.xml adicione a seguinte tag:

 


<!-- Auto Loot -->
<event type="login" name="Auto_Loot_Login" event="script" value="Auto_Loot.lua"/>
<event type="kill" name="Auto_Loot_Kill" event="script" value="Auto_Loot.lua"/>

7° - Em data/talkactions/talkactions.xml adicione a seguinte tag:

 


<!-- Auto Loot -->
<talkaction access="0-4" words="/autoloot;!autoloot" event="script" value="Auto_Loot.lua"/>

 

Créditos

50% Killua(Vitor Bertolucci)

50% Danyel Varejão

 

 

@Danyel Varejao desculpa estar revivendo este topico, estou com esse probleminha aqui:

59f7b48bc7eeb_Semttulo.thumb.png.8a09290b208c90c4ee3a1008078d81bb.png

Pode me ajudar?

Os bichos perdem todo o HP mas não "morrem".

To usando tfs 0.4 cliente 8.60.

Link para o post
Compartilhar em outros sites
  • 1 month later...

ainda bem que fiz backup do meu server antes de colocar isso ai, deu um monte de erro mano, conserta ai pfv, minha distro é limpinha, olha como ta agora: image.thumb.png.514fa8483f3064d14dbe6fe458b08064.png

for fazer algo faz bem feito, ainda bem que deixei pra dar rep quando eu testasse

Link para o post
Compartilhar em outros sites
  • 4 months later...
  • 4 weeks later...

@Danyel Varejao @Digoshow

aqui ta dando esse erro

 

[4/7/2018 19:21:15] [Error - CreatureScript Interface] 
[4/7/2018 19:21:15] In a timer event called from: 
[4/7/2018 19:21:15] data/creaturescripts/scripts/Auto_Loot.lua:onKill
[4/7/2018 19:21:15] Description: 
[4/7/2018 19:21:15] (LuaInterface::luaDoRemoveItem) Item not found

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 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 luanluciano93
      Olá pessoal, estou desenvolvendo esse sistema vip para TFS 1.x, se precisarem de alguma função nova é só comentar, criei para usar em um servidor meu e resolvi postar, bom proveito a todos.
       
      É só ir no arquivo data/lib/core/player.lua e adicionar esse código no começo do script:
      -- ALTER TABLE `accounts` ADD `vip_time` BIGINT(20) NOT NULL DEFAULT 0; -- player:getVipTime() function Player.getVipTime(self) local resultId = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '".. self:getAccountId() .."';") local time = resultId ~= false and result.getNumber(resultId, "vip_time") or 0 result.free(resultId) return time end -- player:isVip() function Player.isVip(self) return self:getVipTime() > os.time() and true or false end -- player:addVipDays(days) function Player.addVipDays(self, days) return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:removeVipDays(days) function Player.removeVipDays(self, days) return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:setVipDays(days) function Player.setVipDays(self, days) return db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:removeVip() function Player.removeVip(self) db.query("UPDATE `accounts` SET `vip_time` = '0' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:sendVipDaysMessage() function Player.sendVipDaysMessage(self) if self:isVip() then local vipTime = self:getVipTime() - os.time() local vipDays = 1 + (math.floor(vipTime / 86400)) return self:getVipTime() ~= false and self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You have '.. vipDays .. ' vip day(s) in your account.') end end -- player:checkVipLogin() function Player.checkVipLogin(self) if self:getVipTime() > 0 and not self:isVip() then return self:removeVip() and self:teleportTo(self:getTown():getTemplePosition()) end end  
       
      As funções são:
      • player:getVipTime() - Retorna o valor da tabela vip_time (igual esta na database).
      • player:isVip() - Retorna se o player é vip ou não.
      • player:addVipDays(days) - Usa-se em algum script para para adicionar dias de vip ao player (parâmetro de entrada "days").
      • player:removeVipDays(days) - Usa-se em algum script para para remover dias de vip do player (parâmetro de entrada "days").
      • player:setVipDays(days) - Usa-se em algum script para para mudar os dias de vip do player (parâmetro de entrada "days").
      • player:removeVip() - Usa-se em algum script para para remover todo tempo de vip do player.
      • player:sendVipDaysMessage() - Retorna uma mensagem no player mostrando os dias de vip que ainda restam ao player.
      • player:checkVipLogin() - Checa se a vip do player acabou, se sim teleporta ele para o templo.
       

      Qualquer dúvida ou erro/bug poste aqui.
    • Por Killua
      Como funciona?
      A cada monstro que vc mata, seus itens equipados ganham 1 de exp. Quando seus itens chegarem às quantidades de exp definidas, eles upam e ficam com o nome assim: Demon Helmet + 1. Helmets, armors, legs, e boots recebem 1 de arm a cada vez que upam. Armas recebem 1 de ataque e escudos 1 de defesa.
       
      Para o monstro contar, ele deve dar um mínimo de exp (definido no script). O número de exp a que me refiro é aquele um presente no arquivo .xml.
       
      Para instalar, crie Killua Items Upgrade.lua em data/creaturescripts/scripts e coloque:
        Em data/creaturescripts/creaturescripts.xml coloque essas duas tags:
      <event type="kill" name="Item level" event="script" value="Killua Items Upgrade.lua"/> <event type="login" name="Item levell" event="script" value="Killua Items Upgrade.lua"/> Configurando: Na tabela table_of_slots, coloque em quais slots os itens upam.
      min_exp é a experiência mínima que o monstro deve ter para contar exp para o item. Se vc colocar 500, somente os monstros que tem exp igual ou superior a 500 no arquivo.xml vão valer.
      exp_levels são os valores de exp que os itens devem atingir para upar. No meu caso, quando o item alcançar 50 de exp, ele upa para o level 1. Quando alcançar 50 de exp, upa para o level 2 e assim por diante.
    • Por Sekk
      Bom, procurei esse Castle por MUITO TEMPO, mas não achei em NENHUM LUGAR DA INTERNET. Ontem, eu estava vendo alguns mapas do @Deathrocks, e vi nos prints, que o mapa possuia o evento que eu queria!
       
      Então baixei o mapa e extrai o evento, então venho lhes trazer!
       
       
      Nome: Castle 24H
      Cliente: 8.6
      Versão TFS: 0.4
      Tipo: Evento
       
      Bom, para começar, vamos em actions/scripts e crie 2 arquivos:
       
      castledoor1.lua
       
      castlewar1.lua
       
        Agora em actions.xml adicione as tags:
       
      Agora em monster/traps crie 3 arquivos:
       
      porta.xml
       
      protectcastle.xml  
      statue.xml  
      Agora em monsters.xml adicione as tags:    
      Vamos para movements/scripts e crie 2 arquivos:
       
      castlewar2.lua
       
      level.lua  
      Agora em movements.xml adicione as tags:  
       
      Pronto. Agora você só precisa baixar o mapa, inserir o mesmo ao seu servidor, configurar os teleports, e as hunts dentro do castle etc.
       
      PRINTS:
      1ª parte
       
      2ª parte:
       
      Obs.: Todos os ActionID e monsters já estão no mapa! Você só precisa configurar as coordenadas dos teleports, e o que possui no castle!
       
      Obs².: Tudo o que você pode configurar, já está escrito em cada script!
       
       
      Créditos:
      @DeathRocks
      PC98
      mapa.rar
    • Por gpedro
      Testado: MySQL & SQLite
      Distro: TFS 0.4_SVN & TFS 0.3.6

      MySQL

      ALTER TABLE `players` ADD `resets` INT(11) NOT NULL DEFAULT "0"; SQLite ALTER TABLE players ADD resets INTEGER not null default 0 Adicionando nas sources player.h procure por: uint32_t level; logo abaixo, adicione: uint32_t resets; iologindata.cpp procure por query << "SELECT `id`, `account_id`, `group_id`, `world_id`, `sex`, `vocation`, `experience`, `level`," substitua por: query << "SELECT `id`, `account_id`, `group_id`, `world_id`, `sex`, `vocation`, `experience`, `level`, `resets`, " procure por player->level = std::max((uint32_t)1, (uint32_t)result->getDataInt("level")); logo abaixo adicione: player->resets = (uint32_t)result->getDataInt("resets"); procure por query << "`maglevel` = " << player->magLevel << ", "; logo abaixo adicione: query << "`resets` = " << player->resets << ", "; players.cpp procure por: s << " (Level " << level << ")"; substitua por: s << " (Level " << level << ") [Reset " << resets << "]"; players.h procure por: void setPromotionLevel(uint32_t pLevel); logo abaixo adicione: uint32_t getResets() { return resets;} void setResets(int32_t amount) { resets += amount; if (resets < 0) {resets = 0;} } luascript.cpp para 0.3.6 static int32_t luaDoPlayerSetIdleTime(lua_State* L); logo abaixo adicione: static int32_t luaGetResets(lua_State* L); static int32_t luaSetResets(lua_State* L); talkactions.xml <talkaction words="!rank;/rank" event="script" value="ranks.lua"/> <talkaction words="!reset;/reset" script="reset.lua"/> ranks.lua
      Créditos: Dark Skyllen, Marcryzius, Mock, Kydrai, Cykotitan, gpedro*.
      * adaptação para 0.4
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo