Ir para conteúdo

Featured Replies

Postado

.Boa tarde pessoal,

Estou com o seguinte problema,

 

Ao tentar usar um comando seja ele !aol,!bless que possui a função

"checkExhausted"

O mesmo gera um erro na distro

Spoiler

Error - TalkAction Interface]
data/talkactions/scripts/bless.lua:onSay
Description:
data/lib/034-exhaustion.lua:17: attempt to compare number with string
stack traceback:
        data/lib/034-exhaustion.lua:17: in function 'get'
        data/talkactions/lib/talkactions.lua:3: in function 'checkExhausted'
        data/talkactions/scripts/bless.lua:2: in function <data/talkactions/scripts/bless.lua:1>

 

Aqui está a lib

Spoiler

exhaustion =
{
	check = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		return getPlayerStorageValue(cid, storage) >= os.time()
	end,

	get = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		local exhaust = getPlayerStorageValue(cid, storage)
		if(exhaust > 0) then
			local left = exhaust - os.time()
			if(left > 0) then
				return left
			end
		end

		return false
	end,

	set = function (cid, storage, time)
		setPlayerStorageValue(cid, storage, os.time() + time)
	end,

	make = function (cid, storage, time)
		local exhaust = exhaustion.get(cid, storage)
		if(not exhaust) then
			exhaustion.set(cid, storage, time)
			return true
		end

		return false
	end
}

 

Alguém poderia me ajudar?

 

Utilizo TFS 0.4 - 8.6 

 

Resolvido por Apache

Ir para solução
Postado
  • Solução

 

data/talkactions/lib/talkactions.lua
function checkExhausted(cid, storage, seconds)
	local v = exhaustion.get(cid, storage)
	if(not v) then
		exhaustion.set(cid, storage, seconds)
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Please wait " .. v .. " seconds before trying this command again.")
		return false
	end

	return true
end
data/lib/034-exhaustion.lua
	get = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		local exhaust = getCreatureStorage(cid, storage)
		if(exhaust > 0) then
			local left = exhaust - os.time()
			if(left >= 0) then
				return left
			end
		end

		return false
	end,

 

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo