Ir para conteúdo
  • Cadastre-se

(Resolvido)Exausted em todas talkactions


Ir para solução Resolvido por L3K0T,

Posts Recomendados

Alguém poderia me ajudar a colocar exausted em todas talkactions, porque estão usando algum comando pra lagar o ot...

 

Sempre quando está lagando tudo, eu dou closesrver, na hora o lag Lara e fica liso, só que quando do openserver, o lagbtodo volta.                    

Meu ot e OTX

 

 

 

 

Editado por vitinhoo96 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 weeks later...

Para colocar exaust e comandos , você terá que adicionar uma função em cada script.

Tente colocar essa função em algum script e teste se vai dar algum erro.

function onUse(cid, item, toPosition)

exhausted = 20 -- tempo em segundos

storage = 5858, -- Storage usada para o exhausted

if(getPlayerStorageValue(cid, cfg.storage) > os.time() and getPlayerStorageValue(cid, cfg.storage) < 100+os.time()) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Aguarde um momento para" .. getPlayerStorageValue(cid, cfg.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, cfg.storage) - os.time()) == 1 and "" or "s") .. " usar esse comando novamente.")

 

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

Para colocar exaust e comandos , você terá que adicionar uma função em cada script.

Tente colocar essa função em algum script e teste se vai dar algum erro.



function onUse(cid, item, toPosition)

exhausted = 20 -- tempo em segundos

storage = 5858, -- Storage usada para o exhausted

if(getPlayerStorageValue(cid, cfg.storage) > os.time() and getPlayerStorageValue(cid, cfg.storage) < 100+os.time()) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Aguarde um momento para" .. getPlayerStorageValue(cid, cfg.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, cfg.storage) - os.time()) == 1 and "" or "s") .. " usar esse comando novamente.")

 

Apareceu esse erro quando fui abrir o ot pra testar

 

>>> Loading talkactions... [Error - LuaInterface::loadFile] data/talkactions/scripts/autoloot.lua:9: unexpected symbol near 'if'
[Error - Event::checkScript] Cannot load script (data/talkactions/scripts/autoloot.lua)
data/talkactions/scripts/autoloot.lua:9: unexpected symbol near 'if'

 

Script do autoloot e como coloquei o que me passou

 

-- Sistema de auto loot criado por V�tor Bertolucci - Killua

function onUse(cid, item, toPosition)

	exhausted = 20 -- tempo em segundos
	
	storage = 5858, -- Storage usada para o exhausted
	
	if (getPlayerStorageValue(cid, cfg.storage) > os.time() and getPlayerStorageValue(cid, cfg.storage) < 100+os.time()) then
	
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Aguarde um momento para" .. getPlayerStorageValue(cid, cfg.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, cfg.storage) - os.time()) == 1 and "" or "s") .. " usar esse comando novamente.")

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

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 04420021) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420021))
	end
	if getPlayerStorageValue(cid, 04420031) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420031))
	end
	if getPlayerStorageValue(cid, 04420041) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420041))
	end
	if getPlayerStorageValue(cid, 04420051) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420051))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function addToList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerList(cid) and isInArray(getPlayerList(cid), itemid) then
		return false
	end
	if getPlayerStorageValue(cid, 04420021) == -1 then
		return doPlayerSetStorageValue(cid, 04420021, itemid)
	elseif getPlayerStorageValue(cid, 04420031) == -1 then
		return doPlayerSetStorageValue(cid, 04420031, itemid)
	elseif getPlayerStorageValue(cid, 04420041) == -1 then	
		return doPlayerSetStorageValue(cid, 04420041, itemid)
	elseif getPlayerStorageValue(cid, 04420051) == -1 then
		return doPlayerSetStorageValue(cid, 04420051, itemid)
	end
end

local function removeFromList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerStorageValue(cid, 04420021) == itemid then
		return doPlayerSetStorageValue(cid, 04420021, -1)
	elseif getPlayerStorageValue(cid, 04420031) == itemid then
		return doPlayerSetStorageValue(cid, 04420031, -1)
	elseif getPlayerStorageValue(cid, 04420041) == itemid then
		return doPlayerSetStorageValue(cid, 04420041, -1)
	elseif getPlayerStorageValue(cid, 04420051) == itemid then
		return doPlayerSetStorageValue(cid, 04420051, -1)
	end
	return false
end

function onSay(cid, words, param)
	if param == "" then
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420021)) or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420031)) or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420041)) or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420051)) or ""
		local stt = getPlayerStorageValue(cid, 04421011) == 1 and "sim" or "nao"
		local str = getPlayerStorageValue(cid, 04421001) == 1 and "sim" or "nao"
		doPlayerPopupFYI(cid, "<--- Informacoes Do Auto Loot --->\n\n--Configurando o AutoLoot--\n\n1- Coletar Dinheiro: !autoloot gold\n2- Ligar coleta de items: !autoloot power\n3- Para adicionar um novo item no autoloot, digite: !autoloot add, nome do item\n4- Para retirar um item do autoloot, digite: !autoloot remove, nome do item\n5- Para limpar todos os slots, digite: !autoloot clear\n6- Para informacoes de quanto voce ja fez utilizando a coleta de dinheiro, use: !autoloot goldinfo\n7- Se seu autoloot bugar use !autoloot desbug\n\n\n[Coletar dinheiro] --- Ligado? ("..stt..").\n[Coletar itens] --- Ligado? ("..str..").\n\n----- Configuracao Dos Slots -----\n[AUTO-LOOT] ---Slot 1: "..fi.."\n[AUTO-LOOT] ---Slot 2: "..se.."\n[AUTO-LOOT] ---Slot 3: "..th.."\n[AUTO-LOOT] ---Slot 4: "..fo.."\n\n\n\n\nWars-Baiak\nwww.war-baiak.com")
		return true
	end
	
	local t = string.explode(param, ",")
	
	if t[1] == "power" then
		local check = getPlayerStorageValue(cid, 04421001) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421001, getPlayerStorageValue(cid, 04421001) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." o auto loot.")
	elseif t[1] == "gold" then
		local check = getPlayerStorageValue(cid, 04421011) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421011, getPlayerStorageValue(cid, 04421011) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." a coleta de dinheiro.")
		doPlayerSetStorageValue(cid, 04421021, 0)
	elseif t[1] == "goldinfo" then
		local str = getPlayerStorageValue(cid, 04421011) == -1 and "O sistema de coleta de dinheiro esta desligado" or "O sistema ja coletou "..getPlayerStorageZero(cid, 04421021).." gold coins"
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
	elseif t[1] == "add" then
		if ExistItemByName(t[2]) then
			local item = getItemIdByName(t[2])
			if isInArray({2160, 2148, 2152}, item) then
				return doPlayerSendCancel(cid, "Voce nao pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold")
			end
			if isPremium(cid) then
				if getPlayerStorageValue(cid, 04420011) < 3 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot list")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Sua lista ja tem 4 itens! Voce deve remover algum antes de adicionar outro.")
				end
			else
				if getPlayerStorageValue(cid, 04420011) < 1 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Voce ja tem um item adicionado no auto loot! Para adicionar outro, voce deve remover o item atual.")
				end
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "remove" then
		if ExistItemByName(t[2]) then
			if removeFromList(cid, t[2]) then
				doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) - 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." removido da sua lista do auto loot!")
			else
				doPlayerSendCancel(cid, "Este item nao esta na sua lista!")
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "clear" then
		if getPlayerStorageValue(cid, 04420011) > -1 then
			doPlayerSetStorageValue(cid, 04420011, -1)
			doPlayerSetStorageValue(cid, 04420021, -1)
			doPlayerSetStorageValue(cid, 04420031, -1)
			doPlayerSetStorageValue(cid, 04420041, -1)
			doPlayerSetStorageValue(cid, 04420051, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!")
		else
			doPlayerSendCancel(cid, "Sua lista ja esta limpa!")
		end
	elseif t[1] == "desbug" or t[1] == "desbugar" then
		doPlayerSetStorageValue(cid, 04420011, -1)
		doPlayerSetStorageValue(cid, 04420021, -1)
		doPlayerSetStorageValue(cid, 04420031, -1)
		doPlayerSetStorageValue(cid, 04420041, -1)
		doPlayerSetStorageValue(cid, 04420051, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!")
	elseif t[1] == "list" then
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420021)).."\n" or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420031)).."\n" or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420041)).."\n" or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420051)).."\n" or ""
		doPlayerPopupFYI(cid, "O sistema auto loot esta coletando:\n "..fi..""..se..""..th..""..fo)
	end
	return true
end
					

 

Editado por vitinhoo96 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Moderador
-- Sistema de auto loot criado por V�tor Bertolucci - Killua

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

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 04420021) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420021))
	end
	if getPlayerStorageValue(cid, 04420031) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420031))
	end
	if getPlayerStorageValue(cid, 04420041) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420041))
	end
	if getPlayerStorageValue(cid, 04420051) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420051))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function addToList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerList(cid) and isInArray(getPlayerList(cid), itemid) then
		return false
	end
	if getPlayerStorageValue(cid, 04420021) == -1 then
		return doPlayerSetStorageValue(cid, 04420021, itemid)
	elseif getPlayerStorageValue(cid, 04420031) == -1 then
		return doPlayerSetStorageValue(cid, 04420031, itemid)
	elseif getPlayerStorageValue(cid, 04420041) == -1 then	
		return doPlayerSetStorageValue(cid, 04420041, itemid)
	elseif getPlayerStorageValue(cid, 04420051) == -1 then
		return doPlayerSetStorageValue(cid, 04420051, itemid)
	end
end

local function removeFromList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerStorageValue(cid, 04420021) == itemid then
		return doPlayerSetStorageValue(cid, 04420021, -1)
	elseif getPlayerStorageValue(cid, 04420031) == itemid then
		return doPlayerSetStorageValue(cid, 04420031, -1)
	elseif getPlayerStorageValue(cid, 04420041) == itemid then
		return doPlayerSetStorageValue(cid, 04420041, -1)
	elseif getPlayerStorageValue(cid, 04420051) == itemid then
		return doPlayerSetStorageValue(cid, 04420051, -1)
	end
	return false
end

local config = {
	storage = 22566,
	exhaust = 2*60
}

function onSay(cid, words, param)


if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "Aguarde " .. (config.exhaust / 60) .. " minutos.")
  return true
end


	if param == "" then
	
	
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420021)) or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420031)) or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420041)) or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420051)) or ""
		local stt = getPlayerStorageValue(cid, 04421011) == 1 and "sim" or "nao"
		local str = getPlayerStorageValue(cid, 04421001) == 1 and "sim" or "nao"
		doPlayerPopupFYI(cid, "<--- Informacoes Do Auto Loot --->\n\n--Configurando o AutoLoot--\n\n1- Coletar Dinheiro: !autoloot gold\n2- Ligar coleta de items: !autoloot power\n3- Para adicionar um novo item no autoloot, digite: !autoloot add, nome do item\n4- Para retirar um item do autoloot, digite: !autoloot remove, nome do item\n5- Para limpar todos os slots, digite: !autoloot clear\n6- Para informacoes de quanto voce ja fez utilizando a coleta de dinheiro, use: !autoloot goldinfo\n7- Se seu autoloot bugar use !autoloot desbug\n\n\n[Coletar dinheiro] --- Ligado? ("..stt..").\n[Coletar itens] --- Ligado? ("..str..").\n\n----- Configuracao Dos Slots -----\n[AUTO-LOOT] ---Slot 1: "..fi.."\n[AUTO-LOOT] ---Slot 2: "..se.."\n[AUTO-LOOT] ---Slot 3: "..th.."\n[AUTO-LOOT] ---Slot 4: "..fo.."\n\n\n\n\nWars-Baiak\nwww.war-baiak.com")
		return true
	end
	
	local t = string.explode(param, ",")
	
	if t[1] == "power" then
		local check = getPlayerStorageValue(cid, 04421001) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421001, getPlayerStorageValue(cid, 04421001) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." o auto loot.")
	elseif t[1] == "gold" then
		local check = getPlayerStorageValue(cid, 04421011) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421011, getPlayerStorageValue(cid, 04421011) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." a coleta de dinheiro.")
		doPlayerSetStorageValue(cid, 04421021, 0)
	elseif t[1] == "goldinfo" then
		local str = getPlayerStorageValue(cid, 04421011) == -1 and "O sistema de coleta de dinheiro esta desligado" or "O sistema ja coletou "..getPlayerStorageZero(cid, 04421021).." gold coins"
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
	elseif t[1] == "add" then
		if ExistItemByName(t[2]) then
			local item = getItemIdByName(t[2])
			if isInArray({2160, 2148, 2152}, item) then
				return doPlayerSendCancel(cid, "Voce nao pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold")
			end
			if isPremium(cid) then
				if getPlayerStorageValue(cid, 04420011) < 3 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot list")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Sua lista ja tem 4 itens! Voce deve remover algum antes de adicionar outro.")
				end
			else
				if getPlayerStorageValue(cid, 04420011) < 1 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Voce ja tem um item adicionado no auto loot! Para adicionar outro, voce deve remover o item atual.")
				end
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "remove" then
		if ExistItemByName(t[2]) then
			if removeFromList(cid, t[2]) then
				doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) - 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." removido da sua lista do auto loot!")
			else
				doPlayerSendCancel(cid, "Este item nao esta na sua lista!")
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "clear" then
		if getPlayerStorageValue(cid, 04420011) > -1 then
			doPlayerSetStorageValue(cid, 04420011, -1)
			doPlayerSetStorageValue(cid, 04420021, -1)
			doPlayerSetStorageValue(cid, 04420031, -1)
			doPlayerSetStorageValue(cid, 04420041, -1)
			doPlayerSetStorageValue(cid, 04420051, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!")
		else
			doPlayerSendCancel(cid, "Sua lista ja esta limpa!")
		end
	elseif t[1] == "desbug" or t[1] == "desbugar" then
		doPlayerSetStorageValue(cid, 04420011, -1)
		doPlayerSetStorageValue(cid, 04420021, -1)
		doPlayerSetStorageValue(cid, 04420031, -1)
		doPlayerSetStorageValue(cid, 04420041, -1)
		doPlayerSetStorageValue(cid, 04420051, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!")
	elseif t[1] == "list" then
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420021)).."\n" or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420031)).."\n" or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420041)).."\n" or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420051)).."\n" or ""
		doPlayerPopupFYI(cid, "O sistema auto loot esta coletando:\n "..fi..""..se..""..th..""..fo)
	end
	
	doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)
	
	return true
end

NÃO TESTEI!

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
16 minutos atrás, L3K0T disse:

-- Sistema de auto loot criado por V�tor Bertolucci - Killua

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

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 04420021) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420021))
	end
	if getPlayerStorageValue(cid, 04420031) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420031))
	end
	if getPlayerStorageValue(cid, 04420041) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420041))
	end
	if getPlayerStorageValue(cid, 04420051) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420051))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function addToList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerList(cid) and isInArray(getPlayerList(cid), itemid) then
		return false
	end
	if getPlayerStorageValue(cid, 04420021) == -1 then
		return doPlayerSetStorageValue(cid, 04420021, itemid)
	elseif getPlayerStorageValue(cid, 04420031) == -1 then
		return doPlayerSetStorageValue(cid, 04420031, itemid)
	elseif getPlayerStorageValue(cid, 04420041) == -1 then	
		return doPlayerSetStorageValue(cid, 04420041, itemid)
	elseif getPlayerStorageValue(cid, 04420051) == -1 then
		return doPlayerSetStorageValue(cid, 04420051, itemid)
	end
end

local function removeFromList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerStorageValue(cid, 04420021) == itemid then
		return doPlayerSetStorageValue(cid, 04420021, -1)
	elseif getPlayerStorageValue(cid, 04420031) == itemid then
		return doPlayerSetStorageValue(cid, 04420031, -1)
	elseif getPlayerStorageValue(cid, 04420041) == itemid then
		return doPlayerSetStorageValue(cid, 04420041, -1)
	elseif getPlayerStorageValue(cid, 04420051) == itemid then
		return doPlayerSetStorageValue(cid, 04420051, -1)
	end
	return false
end

local config = {
	storage = 22566,
	exhaust = 2*60
}

function onSay(cid, words, param)


if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "Aguarde " .. (config.exhaust / 60) .. " minutos.")
  return true
end


	if param == "" then
	
	
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420021)) or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420031)) or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420041)) or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420051)) or ""
		local stt = getPlayerStorageValue(cid, 04421011) == 1 and "sim" or "nao"
		local str = getPlayerStorageValue(cid, 04421001) == 1 and "sim" or "nao"
		doPlayerPopupFYI(cid, "<--- Informacoes Do Auto Loot --->\n\n--Configurando o AutoLoot--\n\n1- Coletar Dinheiro: !autoloot gold\n2- Ligar coleta de items: !autoloot power\n3- Para adicionar um novo item no autoloot, digite: !autoloot add, nome do item\n4- Para retirar um item do autoloot, digite: !autoloot remove, nome do item\n5- Para limpar todos os slots, digite: !autoloot clear\n6- Para informacoes de quanto voce ja fez utilizando a coleta de dinheiro, use: !autoloot goldinfo\n7- Se seu autoloot bugar use !autoloot desbug\n\n\n[Coletar dinheiro] --- Ligado? ("..stt..").\n[Coletar itens] --- Ligado? ("..str..").\n\n----- Configuracao Dos Slots -----\n[AUTO-LOOT] ---Slot 1: "..fi.."\n[AUTO-LOOT] ---Slot 2: "..se.."\n[AUTO-LOOT] ---Slot 3: "..th.."\n[AUTO-LOOT] ---Slot 4: "..fo.."\n\n\n\n\nWars-Baiak\nwww.war-baiak.com")
		return true
	end
	
	local t = string.explode(param, ",")
	
	if t[1] == "power" then
		local check = getPlayerStorageValue(cid, 04421001) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421001, getPlayerStorageValue(cid, 04421001) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." o auto loot.")
	elseif t[1] == "gold" then
		local check = getPlayerStorageValue(cid, 04421011) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421011, getPlayerStorageValue(cid, 04421011) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." a coleta de dinheiro.")
		doPlayerSetStorageValue(cid, 04421021, 0)
	elseif t[1] == "goldinfo" then
		local str = getPlayerStorageValue(cid, 04421011) == -1 and "O sistema de coleta de dinheiro esta desligado" or "O sistema ja coletou "..getPlayerStorageZero(cid, 04421021).." gold coins"
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
	elseif t[1] == "add" then
		if ExistItemByName(t[2]) then
			local item = getItemIdByName(t[2])
			if isInArray({2160, 2148, 2152}, item) then
				return doPlayerSendCancel(cid, "Voce nao pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold")
			end
			if isPremium(cid) then
				if getPlayerStorageValue(cid, 04420011) < 3 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot list")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Sua lista ja tem 4 itens! Voce deve remover algum antes de adicionar outro.")
				end
			else
				if getPlayerStorageValue(cid, 04420011) < 1 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Voce ja tem um item adicionado no auto loot! Para adicionar outro, voce deve remover o item atual.")
				end
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "remove" then
		if ExistItemByName(t[2]) then
			if removeFromList(cid, t[2]) then
				doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) - 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." removido da sua lista do auto loot!")
			else
				doPlayerSendCancel(cid, "Este item nao esta na sua lista!")
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "clear" then
		if getPlayerStorageValue(cid, 04420011) > -1 then
			doPlayerSetStorageValue(cid, 04420011, -1)
			doPlayerSetStorageValue(cid, 04420021, -1)
			doPlayerSetStorageValue(cid, 04420031, -1)
			doPlayerSetStorageValue(cid, 04420041, -1)
			doPlayerSetStorageValue(cid, 04420051, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!")
		else
			doPlayerSendCancel(cid, "Sua lista ja esta limpa!")
		end
	elseif t[1] == "desbug" or t[1] == "desbugar" then
		doPlayerSetStorageValue(cid, 04420011, -1)
		doPlayerSetStorageValue(cid, 04420021, -1)
		doPlayerSetStorageValue(cid, 04420031, -1)
		doPlayerSetStorageValue(cid, 04420041, -1)
		doPlayerSetStorageValue(cid, 04420051, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!")
	elseif t[1] == "list" then
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420021)).."\n" or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420031)).."\n" or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420041)).."\n" or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420051)).."\n" or ""
		doPlayerPopupFYI(cid, "O sistema auto loot esta coletando:\n "..fi..""..se..""..th..""..fo)
	end
	
	doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)
	
	return true
end

NÃO TESTEI!

 

Funcionou certinho, mais teria como por pra usar o comando a cada 5 segundos

 

Link para o post
Compartilhar em outros sites
  • Moderador
  • Solução
2 minutos atrás, vitinhoo96 disse:

 

Funcionou certinho, mais teria como por pra usar o comando a cada 5 segundos

 

-- Sistema de auto loot criado por V�tor Bertolucci - Killua

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

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 04420021) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420021))
	end
	if getPlayerStorageValue(cid, 04420031) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420031))
	end
	if getPlayerStorageValue(cid, 04420041) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420041))
	end
	if getPlayerStorageValue(cid, 04420051) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420051))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function addToList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerList(cid) and isInArray(getPlayerList(cid), itemid) then
		return false
	end
	if getPlayerStorageValue(cid, 04420021) == -1 then
		return doPlayerSetStorageValue(cid, 04420021, itemid)
	elseif getPlayerStorageValue(cid, 04420031) == -1 then
		return doPlayerSetStorageValue(cid, 04420031, itemid)
	elseif getPlayerStorageValue(cid, 04420041) == -1 then	
		return doPlayerSetStorageValue(cid, 04420041, itemid)
	elseif getPlayerStorageValue(cid, 04420051) == -1 then
		return doPlayerSetStorageValue(cid, 04420051, itemid)
	end
end

local function removeFromList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerStorageValue(cid, 04420021) == itemid then
		return doPlayerSetStorageValue(cid, 04420021, -1)
	elseif getPlayerStorageValue(cid, 04420031) == itemid then
		return doPlayerSetStorageValue(cid, 04420031, -1)
	elseif getPlayerStorageValue(cid, 04420041) == itemid then
		return doPlayerSetStorageValue(cid, 04420041, -1)
	elseif getPlayerStorageValue(cid, 04420051) == itemid then
		return doPlayerSetStorageValue(cid, 04420051, -1)
	end
	return false
end

local config = {
	storage = 22566,
	exhaust = 5
}

function onSay(cid, words, param)


if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "Aguarde " .. (config.exhaust) .. " segundos.")
  return true
end


	if param == "" then
	
	
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420021)) or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420031)) or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420041)) or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420051)) or ""
		local stt = getPlayerStorageValue(cid, 04421011) == 1 and "sim" or "nao"
		local str = getPlayerStorageValue(cid, 04421001) == 1 and "sim" or "nao"
		doPlayerPopupFYI(cid, "<--- Informacoes Do Auto Loot --->\n\n--Configurando o AutoLoot--\n\n1- Coletar Dinheiro: !autoloot gold\n2- Ligar coleta de items: !autoloot power\n3- Para adicionar um novo item no autoloot, digite: !autoloot add, nome do item\n4- Para retirar um item do autoloot, digite: !autoloot remove, nome do item\n5- Para limpar todos os slots, digite: !autoloot clear\n6- Para informacoes de quanto voce ja fez utilizando a coleta de dinheiro, use: !autoloot goldinfo\n7- Se seu autoloot bugar use !autoloot desbug\n\n\n[Coletar dinheiro] --- Ligado? ("..stt..").\n[Coletar itens] --- Ligado? ("..str..").\n\n----- Configuracao Dos Slots -----\n[AUTO-LOOT] ---Slot 1: "..fi.."\n[AUTO-LOOT] ---Slot 2: "..se.."\n[AUTO-LOOT] ---Slot 3: "..th.."\n[AUTO-LOOT] ---Slot 4: "..fo.."\n\n\n\n\nWars-Baiak\nwww.war-baiak.com")
		return true
	end
	
	local t = string.explode(param, ",")
	
	if t[1] == "power" then
		local check = getPlayerStorageValue(cid, 04421001) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421001, getPlayerStorageValue(cid, 04421001) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." o auto loot.")
	elseif t[1] == "gold" then
		local check = getPlayerStorageValue(cid, 04421011) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421011, getPlayerStorageValue(cid, 04421011) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." a coleta de dinheiro.")
		doPlayerSetStorageValue(cid, 04421021, 0)
	elseif t[1] == "goldinfo" then
		local str = getPlayerStorageValue(cid, 04421011) == -1 and "O sistema de coleta de dinheiro esta desligado" or "O sistema ja coletou "..getPlayerStorageZero(cid, 04421021).." gold coins"
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
	elseif t[1] == "add" then
		if ExistItemByName(t[2]) then
			local item = getItemIdByName(t[2])
			if isInArray({2160, 2148, 2152}, item) then
				return doPlayerSendCancel(cid, "Voce nao pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold")
			end
			if isPremium(cid) then
				if getPlayerStorageValue(cid, 04420011) < 3 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot list")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Sua lista ja tem 4 itens! Voce deve remover algum antes de adicionar outro.")
				end
			else
				if getPlayerStorageValue(cid, 04420011) < 1 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Voce ja tem um item adicionado no auto loot! Para adicionar outro, voce deve remover o item atual.")
				end
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "remove" then
		if ExistItemByName(t[2]) then
			if removeFromList(cid, t[2]) then
				doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) - 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." removido da sua lista do auto loot!")
			else
				doPlayerSendCancel(cid, "Este item nao esta na sua lista!")
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "clear" then
		if getPlayerStorageValue(cid, 04420011) > -1 then
			doPlayerSetStorageValue(cid, 04420011, -1)
			doPlayerSetStorageValue(cid, 04420021, -1)
			doPlayerSetStorageValue(cid, 04420031, -1)
			doPlayerSetStorageValue(cid, 04420041, -1)
			doPlayerSetStorageValue(cid, 04420051, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!")
		else
			doPlayerSendCancel(cid, "Sua lista ja esta limpa!")
		end
	elseif t[1] == "desbug" or t[1] == "desbugar" then
		doPlayerSetStorageValue(cid, 04420011, -1)
		doPlayerSetStorageValue(cid, 04420021, -1)
		doPlayerSetStorageValue(cid, 04420031, -1)
		doPlayerSetStorageValue(cid, 04420041, -1)
		doPlayerSetStorageValue(cid, 04420051, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!")
	elseif t[1] == "list" then
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420021)).."\n" or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420031)).."\n" or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420041)).."\n" or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420051)).."\n" or ""
		doPlayerPopupFYI(cid, "O sistema auto loot esta coletando:\n "..fi..""..se..""..th..""..fo)
	end
	
	doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)
	
	return true
end

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
9 minutos atrás, L3K0T disse:



-- Sistema de auto loot criado por V�tor Bertolucci - Killua

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

local function getPlayerList(cid)
	local tab = {}
	if getPlayerStorageValue(cid, 04420021) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420021))
	end
	if getPlayerStorageValue(cid, 04420031) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420031))
	end
	if getPlayerStorageValue(cid, 04420041) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420041))
	end
	if getPlayerStorageValue(cid, 04420051) ~= -1 then
		table.insert(tab, getPlayerStorageValue(cid, 04420051))
	end
	if #tab > 0 then
		return tab
	end
	return false
end

local function addToList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerList(cid) and isInArray(getPlayerList(cid), itemid) then
		return false
	end
	if getPlayerStorageValue(cid, 04420021) == -1 then
		return doPlayerSetStorageValue(cid, 04420021, itemid)
	elseif getPlayerStorageValue(cid, 04420031) == -1 then
		return doPlayerSetStorageValue(cid, 04420031, itemid)
	elseif getPlayerStorageValue(cid, 04420041) == -1 then	
		return doPlayerSetStorageValue(cid, 04420041, itemid)
	elseif getPlayerStorageValue(cid, 04420051) == -1 then
		return doPlayerSetStorageValue(cid, 04420051, itemid)
	end
end

local function removeFromList(cid, name)
	local itemid = getItemIdByName(name)
	if getPlayerStorageValue(cid, 04420021) == itemid then
		return doPlayerSetStorageValue(cid, 04420021, -1)
	elseif getPlayerStorageValue(cid, 04420031) == itemid then
		return doPlayerSetStorageValue(cid, 04420031, -1)
	elseif getPlayerStorageValue(cid, 04420041) == itemid then
		return doPlayerSetStorageValue(cid, 04420041, -1)
	elseif getPlayerStorageValue(cid, 04420051) == itemid then
		return doPlayerSetStorageValue(cid, 04420051, -1)
	end
	return false
end

local config = {
	storage = 22566,
	exhaust = 5
}

function onSay(cid, words, param)


if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "Aguarde " .. (config.exhaust) .. " minutos.")
  return true
end


	if param == "" then
	
	
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420021)) or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420031)) or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420041)) or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and getItemNameById(getPlayerStorageValue(cid, 04420051)) or ""
		local stt = getPlayerStorageValue(cid, 04421011) == 1 and "sim" or "nao"
		local str = getPlayerStorageValue(cid, 04421001) == 1 and "sim" or "nao"
		doPlayerPopupFYI(cid, "<--- Informacoes Do Auto Loot --->\n\n--Configurando o AutoLoot--\n\n1- Coletar Dinheiro: !autoloot gold\n2- Ligar coleta de items: !autoloot power\n3- Para adicionar um novo item no autoloot, digite: !autoloot add, nome do item\n4- Para retirar um item do autoloot, digite: !autoloot remove, nome do item\n5- Para limpar todos os slots, digite: !autoloot clear\n6- Para informacoes de quanto voce ja fez utilizando a coleta de dinheiro, use: !autoloot goldinfo\n7- Se seu autoloot bugar use !autoloot desbug\n\n\n[Coletar dinheiro] --- Ligado? ("..stt..").\n[Coletar itens] --- Ligado? ("..str..").\n\n----- Configuracao Dos Slots -----\n[AUTO-LOOT] ---Slot 1: "..fi.."\n[AUTO-LOOT] ---Slot 2: "..se.."\n[AUTO-LOOT] ---Slot 3: "..th.."\n[AUTO-LOOT] ---Slot 4: "..fo.."\n\n\n\n\nWars-Baiak\nwww.war-baiak.com")
		return true
	end
	
	local t = string.explode(param, ",")
	
	if t[1] == "power" then
		local check = getPlayerStorageValue(cid, 04421001) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421001, getPlayerStorageValue(cid, 04421001) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." o auto loot.")
	elseif t[1] == "gold" then
		local check = getPlayerStorageValue(cid, 04421011) == -1 and "ligou" or "desligou"
		doPlayerSetStorageValue(cid, 04421011, getPlayerStorageValue(cid, 04421011) == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce "..check.." a coleta de dinheiro.")
		doPlayerSetStorageValue(cid, 04421021, 0)
	elseif t[1] == "goldinfo" then
		local str = getPlayerStorageValue(cid, 04421011) == -1 and "O sistema de coleta de dinheiro esta desligado" or "O sistema ja coletou "..getPlayerStorageZero(cid, 04421021).." gold coins"
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str)
	elseif t[1] == "add" then
		if ExistItemByName(t[2]) then
			local item = getItemIdByName(t[2])
			if isInArray({2160, 2148, 2152}, item) then
				return doPlayerSendCancel(cid, "Voce nao pode adicionar moedas no autoloot. Para coletar dinheiro use !autoloot gold")
			end
			if isPremium(cid) then
				if getPlayerStorageValue(cid, 04420011) < 3 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot list")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Sua lista ja tem 4 itens! Voce deve remover algum antes de adicionar outro.")
				end
			else
				if getPlayerStorageValue(cid, 04420011) < 1 then
					if addToList(cid, t[2]) then
						doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) + 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." adicionado a sua lista do auto loot! Para ver sua lista diga !autoloot")
					else
						doPlayerSendCancel(cid, t[2].." ja esta em sua lista!")
					end
				else
					doPlayerSendCancel(cid, "Voce ja tem um item adicionado no auto loot! Para adicionar outro, voce deve remover o item atual.")
				end
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "remove" then
		if ExistItemByName(t[2]) then
			if removeFromList(cid, t[2]) then
				doPlayerSetStorageValue(cid, 04420011, getPlayerStorageValue(cid, 04420011) - 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, t[2].." removido da sua lista do auto loot!")
			else
				doPlayerSendCancel(cid, "Este item nao esta na sua lista!")
			end
		else
			doPlayerSendCancel(cid, "Este item nao existe!")
		end
	elseif t[1] == "clear" then
		if getPlayerStorageValue(cid, 04420011) > -1 then
			doPlayerSetStorageValue(cid, 04420011, -1)
			doPlayerSetStorageValue(cid, 04420021, -1)
			doPlayerSetStorageValue(cid, 04420031, -1)
			doPlayerSetStorageValue(cid, 04420041, -1)
			doPlayerSetStorageValue(cid, 04420051, -1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Lista limpa!")
		else
			doPlayerSendCancel(cid, "Sua lista ja esta limpa!")
		end
	elseif t[1] == "desbug" or t[1] == "desbugar" then
		doPlayerSetStorageValue(cid, 04420011, -1)
		doPlayerSetStorageValue(cid, 04420021, -1)
		doPlayerSetStorageValue(cid, 04420031, -1)
		doPlayerSetStorageValue(cid, 04420041, -1)
		doPlayerSetStorageValue(cid, 04420051, -1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Desbugado!")
	elseif t[1] == "list" then
		local fi = getPlayerStorageValue(cid, 04420021) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420021)).."\n" or ""
		local se = getPlayerStorageValue(cid, 04420031) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420031)).."\n" or ""
		local th = getPlayerStorageValue(cid, 04420041) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420041)).."\n" or ""
		local fo = getPlayerStorageValue(cid, 04420051) ~= -1 and ""..getItemNameById(getPlayerStorageValue(cid, 04420051)).."\n" or ""
		doPlayerPopupFYI(cid, "O sistema auto loot esta coletando:\n "..fi..""..se..""..th..""..fo)
	end
	
	doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)
	
	return true
end

 

Perfeito, muito obrigado!

 

So pra mim entender melhor, pra mim por esse exausted em outras talkactions.

Tenho que por esse codigo abaixo, e mecho so na storage dele certo?

 

local config = {
	storage = 22566,
	exhaust = 5
}

function onSay(cid, words, param)


if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "Aguarde " .. (config.exhaust) .. " minutos.")
  return true
end
Editado por vitinhoo96 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Moderador
Agora, vitinhoo96 disse:

Perfeito, muito obrigado!

 

So pra mim entender melhor, pra mim por esse exausted em outras talkactions.

Tenho que por esse codigo abaixo, e mecho so na storage dele certo?

 


local config = {
	storage = 22566,
	exhaust = 5
}

function onSay(cid, words, param)


if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "Aguarde " .. (config.exhaust) .. " minutos.")
  return true
end

e isso la no final  

doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
  • Moderador
Agora, vitinhoo96 disse:

Muito obrigado.

 

tudo certo? 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
4 minutos atrás, L3K0T disse:

tudo certo? 

Sim, funcionou certinho, tenho uma outra duvida, vou abrir outro topico.

 

https://tibiaking.com/forums/topic/107697-logo-guild-no-site-gesior-acc/

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo