local config = {
tempo = 5, --
mensagem = {
texto = "[TOP]", --n
efeito = TEXTCOLOR_LIGHTBLUE -- doSendAnimatedText
},
efeito = 30, --doSendMagicEffect
globalstr = 150202 --
}
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
local name = query:getDataString("name")
setGlobalStorageValue(config.globalstr, ":"..name..",:"..query:getDataInt("level"))
if getPlayerName(cid) == name then
doCreatureSetGuildEmblem(cid, 1)
end
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)
doCreatureSetGuildEmblem(cid, 1)
TopEffect(cid)
end
return true
end
aonde muda ae ?