Ir para conteúdo

Talkaction De Rank Inovadora!


MatheusGlad

Posts Recomendados

Cara ,

coloquei no meu ot e talz , mas os comandos tanto de guild como de monster aparentimente nao funfam , quando os executo aparece a tabela normal de ranks por level , pode dar uma ajuda?

Link para o comentário
Compartilhar em outros sites

meu ot é 8.7 the forgoten server e coloco tudo o que explicaram aí

nenhum rank aparece..

eu coloquei uns ranks de posts antigos.. de 2009 ou 2010, e só pegam o de lvl, mas pelo menos pegou alguma coisa

esse daí não funcionou nada

alguém tem solução? :S

Editado por lucasisara
Link para o comentário
Compartilhar em outros sites

Apague todos os outros rank do script:

 

["fist"] = 74666,

["club"] = 74667,

["sword"] = 74668,

["axe"] = 74669,

["distance"] = 74670,

["shielding"] = 74671,

["fishing"] = 74672,

["magic"] = 74673,

["level"] = 74674,

["monsters"] = 74675,

Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...
--[[ SCRIPTING> MarcelloMkez <scriptING ]]

 

--[[ [Advanced Reset System]

Autor: MarcelloMkez

Versão: 1.0

TFS: 0.3.6

Testado em: 8.50

Fórum: www.xtibia.com/forum/topic/138026-talk-action-advanced-reset-system/

 

[Características]

~ Versão 1.0 ~

 

- Resets no Look;

- Premium Account ou não;

- Mudar Vocação;

- Limite de Resets;

- Opções para Abilitar e Desabilitar Condições;

 

[Em Construção]

 

- Stages Free e Premium;

- 'Talvez' um novo sistema de mudar Vocação;

sem data para postagem. ]]

 

 

 

function onSay(cid, words, param)

 

--[Configurações de Condição]__

 

config = { --[[verdadeiro / Falso]]

 

needPa = false, -- Precisa de Premium Account? [true / false]

needPz = true, -- Precisa estar em Protection Zone? [true / false]

battle = false, -- Precisa estar sem Batlle para Resetar? [true / false]

withe = false, -- Players PK Withe pode Resetar? [true / false]

red = false, -- Players PK Red pode Resetar? [true / false]

tp = true, -- Teleportar para o Templo após o reset? [true / false]

look = true, -- Mostrar Resets no Look do Player? [true / false]

addLimite = false, -- Abilitar Limite de Resets? [true / false]

setClasse = false, -- Mudar Vocação do player quando resetar? [true / false]

storage = 2310, -- Storage [valor]

 

 

--[Configurações do Reset]__

 

resetStatus = {

 

player = getPlayerGUID(cid), -- Não Mude.

lvl = 500 , -- Level Necessário para Resetar. [valor]

lvlreset = 8, -- Level que retornará após o Reset. [valor]

limite = 115, -- Máximo de resets que um player pode chegar. [valor]

newClasse = 1, -- Id da Nova Vocação após o Reset. [valor]

tempo= 5 -- Tempo para o Player deslogar para Resetar. Em segundos. [valor]

},

}

 

--[Funções]__

 

function Reseting(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function noAll(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

return TRUE

end

 

function noTeleporting(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

return TRUE

end

 

function noLook(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

return TRUE

end

 

function noClasse(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function setClasse(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doPlayerSetVocation(cid, config.resetStatus.newClasse)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function look(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function teleporting(cid)

resets = getResets(cid)

setPlayerStorageValue(cid,config.storage,resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

doRemoveCreature(cid)

db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)

db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)

return TRUE

end

 

function getResets(cid)

resets = getPlayerStorageValue(cid,config.storage)

 

if resets < 0 then

resets = 0

end

return resets

 

end

 

 

local resets = getResets(cid)

local needLvl ="Você precisa de "..config.resetStatus.lvl-getPlayerLevel(cid).." level's para resetar."

local msg ="~~[Reset: "..getResets(cid).."]~~ 'Sucesso ao Resetar! Você será deslogado em "..config.resetStatus.tempo.." Segundos."

 

 

--[Condiçoes]__

 

if(config.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then

doPlayerSendTextMessage(cid,22,"Você Precisa estar em Protection Zone Para Resetar.")

return TRUE

 

elseif(config.addLimite == true) and (getResets(cid) == config.resetStatus.limite) then

doPlayerSendTextMessage(cid, 22, "Você ja atingiu o Limite de Resets.")

return TRUE

 

elseif(config.withe == false) and (getCreatureSkullType(cid) == 3) then

doPlayerSendTextMessage(cid,22,"Você ta PK White, por isso não pode resetar.")

return TRUE

 

elseif(config.red == false) and (getCreatureSkullType(cid) == 4) then

doPlayerSendTextMessage(cid,22,"Você ta PK Red, por isso não pode resetar.")

return TRUE

 

elseif(config.needPa == true) and not isPremium(cid) then

doPlayerSendTextMessage(cid,22,"Você Precisa ser Premium Account para Resetar.")

return TRUE

 

elseif(config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then

doPlayerSendTextMessage(cid,22,"Você Precisa estar sem Battle para Resetar.")

return TRUE

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == true) then

addEvent(Reseting, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == false) then

addEvent(noAll, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == true) then

addEvent(noTeleporting, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == true) then

addEvent(noLook, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == false) then

addEvent(noClasse, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == true) then

addEvent(setClasse, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == false) then

addEvent(look, config.resetStatus.tempo* 1000, cid)

 

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == false) then

addEvent(teleporting, config.resetStatus.tempo* 1000, cid)

 

elseif doPlayerSendCancel(cid, needLvl) then

doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)

return TRUE

end

 

if doPlayerPopupFYI(cid, msg) then

 

end

return TRUE

 

end

 

--[by: MarcelloMkez]__

 

Esse ae!

Ja ta funcionando e tudo so faltava o RANK de reset :)

Link para o comentário
Compartilhar em outros sites

<?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,
["resets"] = 74677,
}

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>

 

E o seu reset bota assim:

--[[ SCRIPTING> MarcelloMkez <scriptING ]]

--[[ [Advanced Reset System]
Autor: MarcelloMkez
Versão: 1.0
TFS: 0.3.6
Testado em: 8.50
Fórum: www.xtibia.com/forum/topic/138026-talk-action-advanced-reset-system/

[Características]
~ Versão 1.0 ~

- Resets no Look;
- Premium Account ou não;
- Mudar Vocação;
- Limite de Resets;
- Opções para Abilitar e Desabilitar Condições;

[Em Construção]

- Stages Free e Premium;
- 'Talvez' um novo sistema de mudar Vocação;
sem data para postagem. ]]



function onSay(cid, words, param)

--[Configurações de Condição]__

config = { --[[verdadeiro / Falso]]

needPa = false, -- Precisa de Premium Account? [true / false]
needPz = true, -- Precisa estar em Protection Zone? [true / false]
battle = false, -- Precisa estar sem Batlle para Resetar? [true / false]
withe = false, -- Players PK Withe pode Resetar? [true / false]
red = false, -- Players PK Red pode Resetar? [true / false]
tp = true, -- Teleportar para o Templo após o reset? [true / false]
look = true, -- Mostrar Resets no Look do Player? [true / false]
addLimite = false, -- Abilitar Limite de Resets? [true / false]
setClasse = false, -- Mudar Vocação do player quando resetar? [true / false]
storage = 2310, -- Storage [valor]


--[Configurações do Reset]__

resetStatus = {

player = getPlayerGUID(cid), -- Não Mude.
lvl = 500 , -- Level Necessário para Resetar. [valor]
lvlreset = 8, -- Level que retornará após o Reset. [valor]
limite = 115, -- Máximo de resets que um player pode chegar. [valor]
newClasse = 1, -- Id da Nova Vocação após o Reset. [valor]
tempo= 5 -- Tempo para o Player deslogar para Resetar. Em segundos. [valor]
},
}

--[Funções]__

function Reseting(cid)
domodlib('RankLib')
resets = getResets(cid)
setGlobalStorageValue(74677, getGlobalStorageValue(74677) == -1 and "" or getGlobalStorageValue(74677))
addRankPlayer("resets", getCreatureName(cid), resets+1)
setPlayerStorageValue(cid,config.storage,resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end

function noAll(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
return TRUE
end

function noTeleporting(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
return TRUE
end

function noLook(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
return TRUE
end

function noClasse(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end

function setClasse(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end

function look(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end

function teleporting(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end

function getResets(cid)
resets = getPlayerStorageValue(cid,config.storage)

if resets < 0 then
resets = 0
end
return resets

end


local resets = getResets(cid)
local needLvl ="Você precisa de "..config.resetStatus.lvl-getPlayerLevel(cid).." level's para resetar."
local msg ="~~[Reset: "..getResets(cid).."]~~ 'Sucesso ao Resetar! Você será deslogado em "..config.resetStatus.tempo.." Segundos."


--[Condiçoes]__

if(config.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid,22,"Você Precisa estar em Protection Zone Para Resetar.")
return TRUE

elseif(config.addLimite == true) and (getResets(cid) == config.resetStatus.limite) then
doPlayerSendTextMessage(cid, 22, "Você ja atingiu o Limite de Resets.")
return TRUE

elseif(config.withe == false) and (getCreatureSkullType(cid) == 3) then
doPlayerSendTextMessage(cid,22,"Você ta PK White, por isso não pode resetar.")
return TRUE

elseif(config.red == false) and (getCreatureSkullType(cid) == 4) then
doPlayerSendTextMessage(cid,22,"Você ta PK Red, por isso não pode resetar.")
return TRUE

elseif(config.needPa == true) and not isPremium(cid) then
doPlayerSendTextMessage(cid,22,"Você Precisa ser Premium Account para Resetar.")
return TRUE

elseif(config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid,22,"Você Precisa estar sem Battle para Resetar.")
return TRUE

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == true) then
addEvent(Reseting, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == false) then
addEvent(noAll, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == true) then
addEvent(noTeleporting, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == true) then
addEvent(noLook, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == false) then
addEvent(noClasse, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == true) then
addEvent(setClasse, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == false) then
addEvent(look, config.resetStatus.tempo* 1000, cid)

elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == false) then
addEvent(teleporting, config.resetStatus.tempo* 1000, cid)

elseif doPlayerSendCancel(cid, needLvl) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return TRUE
end

if doPlayerPopupFYI(cid, msg) then

end
return TRUE

end

--[by: MarcelloMkez]__

Link para o comentário
Compartilhar em outros sites

entao usa esse...

 

talk/script

crie arquivo.lua talk/script renomeie para rankinng

 

function getPlayerNameByGUID2(n)
local c = db.getResult("SELECT `name` FROM `players` WHERE `id` = "..n..";")
if c:getID() == -1 then
return "SQL_ERROR["..n.."]"
end
return c:getDataString("name")
end

function onSay(cid, words, param)
local max = 10
local letters_to_next = 20

local skills = {
['fist'] = 0,
['club'] = 1,
['sword'] = 2,
['axe'] = 3,
['distance'] = 4,
['shielding'] = 5,
['fishing'] = 6,
['dist'] = 4,
['shield'] = 5,
['fish'] = 6,
}
local name_now
local name = "Highscore for level\n"
local rkn = 0
local no_break = 0
param = string.lower(param)
dofile('config.lua')
if param == "" or param == "level" and ( param ~= "magic" and param == "ml") and skills[param] == nil then
name = name.."\n"
name = name.."Rank Level - Nome do Jogador\n"
local v = db.getResult("SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` <= 2 ORDER BY `experience` DESC LIMIT 0,"..(max)..";")
repeat
no_break = no_break +1
if v:getID() == -1 then
break
end
rkn = rkn+1
name_now, l = v:getDataString("name"), string.len(v:getDataString("name"))
space = ""
for i=1, letters_to_next-l do
space = space.." "
end
name = name..rkn..". "..v:getDataInt("level") .." - "..name_now..space.." ".."\n" 
if no_break >= 20 then
break
end
until v:next() == false

elseif param == "magic" or param == "ml" then
name = name.."\n"
name = name.."Rank Magic - Nome do Jogador\n"
local v = db.getResult("SELECT `name`, `level`, `maglevel` FROM `players` WHERE `group_id` <= 2 ORDER BY `maglevel` DESC LIMIT 0,"..(max)..";")
repeat
if v:getID() == -1 then
break
end
rkn = rkn+1
name_now, l = v:getDataString("name"), string.len(v:getDataString("name"))
space = ""
for i=1, letters_to_next-l do
space = space.." "
end
name = name..rkn..". "..v:getDataInt("maglevel").." - "..name_now..space.." ".." ".."".."\n" 
until v:next() == false

elseif param == "reset" or param == "resets" then
name = name.."\n"
name = name.."Rank Reset - Nome do Jogador\n"
local v = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 1020 ORDER BY cast(value as INTEGER) DESC;")
local kk = 0

repeat
if kk == max or v:getID() == -1 then
break
end
kk = kk+1
name_now, l = getPlayerNameByGUID2(v:getDataInt("player_id")), string.len(getPlayerNameByGUID2(v:getDataInt("player_id")))
space = ""
for i=1, letters_to_next-l do
space = space.." "
end
if name_now == nil then
name_now = 'sql error['..v:getDataInt("player_id")..']'
end
name = name..kk..". "..v:getDataInt("value").." - "..name_now..space.." \n"
until v:next() == false

elseif skills[param] ~= nil then
name = name.."\n"
name = name.."Rank "..param.." fighting - Nome do Jogador\n"
local v = db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = "..skills[param].." ORDER BY `value` DESC;")
local kk = 0

repeat
if kk == max or v:getID() == -1 then
break
end
kk = kk+1
name_now, l = getPlayerNameByGUID2(v:getDataInt("player_id")), string.len(getPlayerNameByGUID2(v:getDataInt("player_id")))
space = ""
for i=1, letters_to_next-l do
space = space.." "
end

if name_now == nil then
name_now = 'sql error['..v:getDataInt("player_id")..']'
end
name = name..kk..". "..v:getDataInt("value").." - "..name_now..space.." \n"
until v:next() == false
end
if name ~= "Highscore\n" then 
doPlayerPopupFYI(cid, name)
end

return TRUE
end

 

crie arquivo.lua talk/script renomeie para "reset"

 

-- Script By Pauliin Carvalho
function onSay(cid, words, param)
local level = 717217 --level pra ser resetado
local RemainingLvl = 8 --lvl que ele ficara depois do reset
local pid = getPlayerGUID(cid)

function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,1020,resets+1)
return true
end

function getResets(cid)
resets = getPlayerStorageValue(cid,1020)
if resets < 0 then
resets = 0
end
return resets
end

if getPlayerLevel(cid) >= level then
addReset(cid)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doPlayerPopupFYI(cid,"you now was reset, you have "..getResets(cid).." reset.")
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..RemainingLvl..", `experience` = 0 WHERE `id` = "..pid)

else
doPlayerSendCancel(cid, "You need to have level "..level.." or more you may be reset.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end

return TRUE
end

 

talk.xml adione na coluna player isso...

<talkaction words="!reset" script="reset.lua"/>
<talkaction words="!rank" script="rank.lua"/>

Editado por Samuel127
Link para o comentário
Compartilhar em outros sites

Boa... Deu certinho.. Porem tem como mi explicar se e possivel colocar esse seu system de reset pa ficar mostrando os resets no look. ou se tem como separar os resets em classes? por exemplo Primeira "5" resets no maximo

segunda "10" resets no maximo

 

Entende?

 

Mais ficou muito bom mesmo brother.. se puder mi ajudar nisso ai :)

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...