Ir para conteúdo

Featured Replies

Postado

Boa tarde Pessoal estou com um probleminha num script.

 

O script faz no checagem do Top level do servidor e envia mensagem para todo servidor avisando que tal jogador virou top level,porem testei e no meu servidor 8.60 tfs 0.4.0 SNV e não obtive sucesso

alguém pode informar o que tem de errado no script? 

 

Segue abaixo.

function getTop() -- função by vodkart
local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;")
if (query:getID() ~= -1) then
return {query:getDataString("name"),query:getDataInt("level")}
end
return false
end


function onAdvance(cid, oldLevel, newLevel)
if skill == 8 then
local top = getTop()
if newLevel > top[2] and getCreatureName(cid) ~= top[1] then
broadcastMessage(getCreatureName(cid).." é o novo TOP do servidor ele está no level [" .. newLevel .. " ] .", 25)
end
end
return true
end
registerCreatureEvent(cid, "checkNewTop")
<event type="advance" name="checkNewTop" script="newtop.lua"/>

Resolvido por MaXwEllDeN

Ir para solução
  • Respostas 5
  • Visualizações 397
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Não estava funcionando porque skill possuía um valor nulo, já que não foi declarado. Tenta assim: local function getTop() -- função by vodkart local query = db.getResult("SELECT `name`, `level` FR

Postado

Tenta assim amigo .. 

local function getTop() -- função by vodkart
	
	local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;")
	if (query:getID() ~= -1) then
		return {query:getDataString("name"),query:getDataInt("level")}
	end
	
	return false
end


function onAdvance(cid, oldLevel, newLevel)
	
	local top = getTop()
	if skill == 8 then
		if newLevel > top[2] and getCreatureName(cid) ~= top[1] then
			doBroadcastMessage(getCreatureName(cid).." é o novo TOP do servidor, ele está no level " .. newLevel .. ".", 22)
		end
	end

	return true
end
Postado
  • Solução

Não estava funcionando porque skill possuía um valor nulo, já que não foi declarado. Tenta assim:

local function getTop() -- função by vodkart

	local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;")
	if (query:getID() ~= -1) then
		return {query:getDataString("name"),query:getDataInt("level")}
	end

	return false
end


function onAdvance(cid, skill, oldLevel, newLevel)

	local top = getTop()
	if skill == 8 then
		if newLevel > top[2] and getCreatureName(cid) ~= top[1] then
			doBroadcastMessage(getCreatureName(cid).." é o novo TOP do servidor, ele está no level " .. newLevel .. ".", 22)
		end
	end

	return true
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