Bem, a talkaction é a mesma coisa que o !rank que conhecemos, porem voce pode adicionar outros ranks e ela atualiza exatamente na hora que alguem upa.
Exemplos de novos ranks:
Rank para ver quem morreu mais.
Rank para level de players vip.
Rank para ver quem matou mais monstros no ot.
E varios outros...
Bem se alguem quizer implementar um novo rank, peça no topico e mande PM para mim (Nao adianta so pedir no topico porque eu nao irei lembrar de entrar nele).
O script está em mod, bem mais facil de instalar.
Va na pasta mods do seu ot e adicione o arquivo: RankSystem em formato XML e adicione isso:
<?xml version="1.0" encoding="UTF-8"?> <mod name="RankSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="RankLib"><![CDATA[ ranks = { ["fist"] = 74666, ["club"] = 74667, ["sword"] = 74668, ["axe"] = 74669, ["distance"] = 74670, ["shielding"] = 74671, ["fishing"] = 74672, ["magic"] = 74673, ["level"] = 74674, ["monsters"] = 74675, ["guilds"] = 74676 } function havePlayerInRank(rank, playername) -- Checa se o player ja esta no rank. local rankstr = getGlobalStorageValue(ranks[rank]) local players = string.explode(rankstr, "; ") for i,x in pairs(players) do local a, b = string.find(x, "%[") if b ~= nil then if x:sub(1, b-1):lower() == playername:lower() then return TRUE end end end end function getPlayerLevelInRank(rank, playername) -- Pega o level de algum player no rank (Importante para novos tipos de rank.) local rankstr = getGlobalStorageValue(ranks[rank]) local players = string.explode(rankstr, "; ") for i,x in pairs(players) do local a, b = string.find(x, "%[") local t = string.match(x, "%[(.+)]") if b ~= nil and x:sub(1, b-1):lower() == playername:lower() then return t end end return 0 end function addRankPlayer(rank, playername, rankvalue) -- Adiciona um player ao rank ou muda o valor dele no rank. if not havePlayerInRank(rank, playername) then setGlobalStorageValue(ranks[rank], getGlobalStorageValue(ranks[rank]) .. (playername .. "[" .. rankvalue .. "]; ")) else local a,b = string.find(getGlobalStorageValue(ranks[rank]), playername) local c,d = string.find(getGlobalStorageValue(ranks[rank]), playername .. "%[%d+]") setGlobalStorageValue(ranks[rank], getGlobalStorageValue(ranks[rank]):sub(1, b+1) .. rankvalue .. "]; " .. getGlobalStorageValue(ranks[rank]):sub(d+2)) end end function tablelen(tab) -- By MatheusMkalo local result = 0 for i,x in pairs(tab) do result = result+1 end return result end function getRank(rank, maxplayers) -- Pega a lista de players com maior level do rank local rankstr = getGlobalStorageValue(ranks[rank]) local playerstatus = string.explode(rankstr, "; ") local tab = {} local rankTab = {} local rankStr = "Highscore for " .. rank .. "\n\n" .. (isInArray({"monsters", "guilds"}, rank) and "Number of Kills" or "Rank Level") .. " - " .. (rank == "guilds" and "Guild Name" or "Player Name") .. "\n" table.remove(playerstatus, #playerstatus) for i,x in pairs(playerstatus) do local a, b = string.find(x, "%[") local t = string.match(x, "%[(.+)]") tab[x:sub(1, b-1)] = tonumber(t) end local lastname = "" local lastvalue = 0 for i = 1, maxplayers do if tablelen(tab) <= 0 then break end for s,x in pairs(tab) do if x > lastvalue then lastvalue = x lastname = s end end table.insert(rankTab, lastvalue .. " - " .. lastname) tab[lastname] = nil lastname = "" lastvalue = 0 end for i,x in ipairs(rankTab) do rankStr = rankStr .. (i .. ". ") .. x .. "\n" end return rankStr end ]]></config> <talkaction words="!rank;/rank" event="script"><![CDATA[ domodlib('RankLib') if ranks[param:lower()] then setGlobalStorageValue(ranks[param:lower()], getGlobalStorageValue(ranks[param:lower()]) == -1 and "" or getGlobalStorageValue(ranks[param:lower()])) doShowTextDialog(cid, 6500, getRank(param:lower(), 10)) else return doPlayerSendCancel(cid, "Esse rank nao existe ou voce nao digitou corretamente.") end return TRUE ]]></talkaction> <creaturescript type="advance" name="RankSystem" event="script"><![CDATA[ domodlib('RankLib') if skill == 0 then setGlobalStorageValue(74666, getGlobalStorageValue(74666) == -1 and "" or getGlobalStorageValue(74666)) addRankPlayer("fist", getCreatureName(cid), newLevel) elseif skill == 1 then setGlobalStorageValue(74667, getGlobalStorageValue(74667) == -1 and "" or getGlobalStorageValue(74667)) addRankPlayer("club", getCreatureName(cid), newLevel) elseif skill == 2 then setGlobalStorageValue(74668, getGlobalStorageValue(74668) == -1 and "" or getGlobalStorageValue(74668)) addRankPlayer("sword", getCreatureName(cid), newLevel) elseif skill == 3 then setGlobalStorageValue(74669, getGlobalStorageValue(74669) == -1 and "" or getGlobalStorageValue(74669)) addRankPlayer("axe", getCreatureName(cid), newLevel) elseif skill == 4 then setGlobalStorageValue(74670, getGlobalStorageValue(74670) == -1 and "" or getGlobalStorageValue(74670)) addRankPlayer("distance", getCreatureName(cid), newLevel) elseif skill == 5 then setGlobalStorageValue(74671, getGlobalStorageValue(74671) == -1 and "" or getGlobalStorageValue(74671)) addRankPlayer("shielding", getCreatureName(cid), newLevel) elseif skill == 6 then setGlobalStorageValue(74672, getGlobalStorageValue(74672) == -1 and "" or getGlobalStorageValue(74672)) addRankPlayer("fishing", getCreatureName(cid), newLevel) elseif skill == 7 then setGlobalStorageValue(74673, getGlobalStorageValue(74673) == -1 and "" or getGlobalStorageValue(74673)) addRankPlayer("magic", getCreatureName(cid), newLevel) elseif skill == 8 then setGlobalStorageValue(74674, getGlobalStorageValue(74674) == -1 and "" or getGlobalStorageValue(74674)) addRankPlayer("level", getCreatureName(cid), newLevel) end return TRUE ]]></creaturescript> <creaturescript type="kill" name="KillRank" event="script"><![CDATA[ domodlib('RankLib') setGlobalStorageValue(74675, getGlobalStorageValue(74675) == -1 and "" or getGlobalStorageValue(74675)) if isMonster(target) then addRankPlayer("monsters", getCreatureName(cid), getPlayerLevelInRank("monsters", getCreatureName(cid))+1) end if isPlayer(target) then if getPlayerGuildId(cid) > 0 then if lastHit then if getPlayerGuildId(target) <= 0 or getPlayerGuildId(target) ~= getPlayerGuildId(cid) then addRankPlayer("guilds", getPlayerGuildName(cid), getPlayerLevelInRank("guilds", getPlayerGuildName(cid))+1) end end end end return TRUE ]]></creaturescript> <creaturescript type="login" name="RankEvents" event="script"><![CDATA[ registerCreatureEvent(cid, "KillRank") registerCreatureEvent(cid, "RankSystem") return TRUE ]]></creaturescript> </mod>
Alem dos ranks normais, eu inclui um rank para os maiores matadores de monstros, para voces poderem ter uma ideia de como incluir novos ranks.
PARA QUE O SCRIPT FUNCIONE RETIRE ESSA LINHA DO TALKACTIONS.XML:
<talkaction words="!rank;/rank" event="script" value="ranks.lua"/>
OBS: Para usar o rank novo use /rank ou !rank e o nome dos skills que se encontram nessa table:
ranks = {
["fist"] = 74666,
["club"] = 74667,
["sword"] = 74668,
["axe"] = 74669,
["distance"] = 74670,
["shielding"] = 74671,
["fishing"] = 74672,
["magic"] = 74673,
["level"] = 74674,
["monsters"] = 74675
}
No caso do novo rank seria /rank monsters.
Para mudar o numero de players mostrados no rank mude essa linha no mod:
doShowTextDialog(cid, 2160, getRank(param:lower(), 10))
10 eh o numero de players que vai mostrar.
Adicionado /rank guilds, que mostra as guilds que mais mataram no ot.
Agora com aparencia e frases exatamente iguais ao /rank padrao.
È Isso ai comentem!