Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Olá pessoal, estou com um probleminha aqui no newsticker announcer.. Creio que ele é de uma versão anterior à 1.0.

Segue abaixo o script e o erro que aparece no console:

function onThink(interval, lastExecution)
	local result = db.getResult("SELECT text FROM `z_news_tickers` ORDER by date DESC LIMIT 0,5") 
	local sorteado = math.random(1, 5)
	local news = {}
	
		if result:getID() == -1 then
			return false
		end

		repeat
			if result:getID() ~= -1 then
				table.insert(news, result:getDataString("text"))
			end
		until not result:next()

		if not news[sorteado] then
			return false
		end

	doBroadcastMessage("News: " .. string.sub(news[sorteado], 1, 150) .. "", MESSAGE_EVENT_ADVANCE)
    return TRUE
end

O script eu peguei aqui do fórum mesmo, só que o tópico já tem mais de um ano e fiquei com medo de upar o mesmo.

Segue o erro aparecido:

ad73d0c971.png

 

  • Respostas 5
  • Visualizações 444
  • Created
  • Última resposta

Top Posters In This Topic

Postado
function onThink(interval, lastExecution)
	local result = db.storeQuery("SELECT text FROM `z_news_tickers` ORDER by date DESC LIMIT 0,5") 
	local sorteado = math.random(1, 5)
	local news = {}
	if result:getID() == -1 then
		return false
	end
	repeat
	if result:getID() ~= -1 then
		table.insert(news, result:getDataString("text"))
	end
	until not result:next()
	if not news[sorteado] then
		return false
	end
	doBroadcastMessage("News: " .. string.sub(news[sorteado], 1, 150) .. "", MESSAGE_EVENT_ADVANCE)
    return true
end

 

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

Eternera Tibia Server - RPG

Postado
  • Autor
10 horas atrás, anderkrox disse:

function onThink(interval, lastExecution)
	local result = db.storeQuery("SELECT text FROM `z_news_tickers` ORDER by date DESC LIMIT 0,5") 
	local sorteado = math.random(1, 5)
	local news = {}
	if result:getID() == -1 then
		return false
	end
	repeat
	if result:getID() ~= -1 then
		table.insert(news, result:getDataString("text"))
	end
	until not result:next()
	if not news[sorteado] then
		return false
	end
	doBroadcastMessage("News: " .. string.sub(news[sorteado], 1, 150) .. "", MESSAGE_EVENT_ADVANCE)
    return true
end

 

Olá, agradeço a tentativa mas não deu:

50a7d5261d.png

  • 2 weeks later...

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.7k

Informação Importante

Confirmação de Termo