local config = { tempo = 5, --tempo em segundos mensagem = { texto = "[TOP]", --não use mais de 9 caracteres efeito = TEXTCOLOR_LIGHTBLUE --efeito para a função doSendAnimatedText }, efeito = 30, --efeito da função doSendMagicEffect globalstr = 150202 -- uma global storage qualquer q esteje vazia } function TopEffect(cid) local var = tostring(getGlobalStorageValue(config.globalstr)):gsub(':', ''):explode(',') if not isCreature(cid) or getPlayerName(cid) ~= var[1] then return LUA_ERROR end doSendAnimatedText(getCreaturePosition(cid), config.mensagem.texto, config.mensagem.efeito) doSendMagicEffect(getCreaturePosition(cid), config.efeito) addEvent(TopEffect, config.tempo*1000, cid) end function onLogin(cid) if tonumber(getGlobalStorageValue(config.globalstr)) then -- virgin local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` < 2 ORDER BY `level` DESC LIMIT 1") if (query:getID() ~= -1) then setGlobalStorageValue(config.globalstr, ":"..query:getDataString("name")..",:"..query:getDataInt("level")) TopEffect(cid) end else TopEffect(cid) end registerCreatureEvent(cid, "CheckTop") return true end function onAdvance(cid, skill, oldLevel, newLevel) if skill ~= SKILL__LEVEL then return true end local var = tostring(getGlobalStorageValue(config.globalstr)):gsub(':', ''):explode(',') if newLevel > tonumber(var[2]) then doBroadcastMessage("O jogador " .. getPlayerName(cid) .. " tornou-se o novo Top Level. Parabens!", 22) setGlobalStorageValue(config.globalstr, ":"..getPlayerName(cid)..",:"..newLevel) TopEffect(cid) end return true end