Ir para conteúdo
  • 0

(Pedido)Rank Reset No 2.0


nonhock

Pergunta

Gostaria de 1 sistema de rank !reset para o sistema 2.0 de resets do Marcelo,onde nao usa storage e sim a database...

 

 

esse é meu sistema de reset:

http://www.xtibia.com/forum/topic/142463-advanced-reset-system-20/

 

 

 

Por favor 1 !rank reset para meu ot dou rep !

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

va em data / scripts / ranks.lua

 

deleta tudo la dentro

 

dps adiciona

 

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("play er_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("play er_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

 

ai vai ter o !rank reset e os outros ranks vao continuar a funcionar

Link para o comentário
Compartilhar em outros sites

  • 0

não vai funcionar, o do marcelo é por db e não por storage xD

 

 

data/talkactions/ranks.lua

 

local config = {
MaxPlayer = 20,
fight_skills = {
	['fist'] = 0,
	['club'] = 1,
	['sword'] = 2,
	['axe'] = 3,
	['distance'] = 4,
	['shielding'] = 5,
	['fishing'] = 6,
	['dist'] = 4,
	['shield'] = 5,
	['fish'] = 6,
},
other_skills = {
[''] = "level",
['level'] = "level",
['magic'] = "maglevel",
['health'] = "healthmax",
['mana'] = "manamax",
['reset'] = "reset"
},
vocations = {
['sorcerer'] = {1,5},
['druid'] = {2,6},
['paladin'] = {3,7},
['knight'] = {4,8}
}
}
function onSay(cid, words, param)
local param,str = string.lower(param),""
if param ~= "frags" and not config.fight_skills[param] and not config.other_skills[param] and not config.vocations[param] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "este rank não existe.") return true
end
str,k = "--[ RANK "..(param == "" and "LEVEL" or string.upper(param)).." ]--\n\n",1
if param == "frags" then
  local time,T = os.time(),{}
  local times = {today = (time - 86400), week = (time - (7 * 86400))}
 local getPlayer = db.getResult("SELECT `id` FROM `players`;")
 repeat
 if (getPlayer:getID() ~= -1) then
 local getGuid = getPlayer:getDataInt("id")
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = "..tonumber(getGuid).." AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if (result:getID() ~= -1) then
		repeat
				local content = {date = result:getDataInt("date")}
				if(content.date > times.today) then
						table.insert(contents.day, content)
				elseif(content.date > times.week) then
						table.insert(contents.week, content)
				else
						table.insert(contents.month, content)
				end
		size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)}
		until not result:next()
		table.insert(T,{getGuid,size.day+size.week+size.month})
		result:free()
end
end
until not getPlayer:next()
table.sort(T, function(x,y) return x[2] > y[2] end)
for _, rank in pairs(T) do
str = str .."\n"..k..". "..getPlayerNameByGUID(rank[1]).." - ["..rank[2].."]"
k = k + 1
if k > config.MaxPlayer then
break
end
end
doShowTextDialog(cid,6500, str)
return true
end
query = config.fight_skills[param] and db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = "..config.fight_skills[param].." ORDER BY `value` DESC;") or config.other_skills[param] and db.getResult("SELECT `name`, `"..config.other_skills[param].."` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `"..config.other_skills[param].."` DESC, `name` ASC;") or db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` <= 2 AND `vocation` = "..config.vocations[param][1].." or `vocation` = "..config.vocations[param][2].." ORDER BY `level` DESC;")
if (query:getID() ~= -1) then
while true do
str = str .. "\n " .. k .. ". "..(config.fight_skills[param] and getPlayerNameByGUID(query:getDataString("player_id")) or query:getDataString("name")).." - [" .. query:getDataInt(config.fight_skills[param] and "value" or config.vocations[param] and "level" or config.other_skills[param]) .. "]"
k = k + 1
if not(query:next()) or k > config.MaxPlayer then
break
end
end
query:free()
end
doShowTextDialog(cid,6500, str)
return true
end

 

 

além de rank reset esse que eu te passei tem:

 

rank magic

rank health

rank mana

rank frags

 

rank vocs

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

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...