Ir para conteúdo
  • 0

Rank Mana E Vida É Possivel?


SamueLGuedes

Pergunta

15 respostass a esta questão

Posts Recomendados

  • 0

ta ai:

 

 

function onSay(cid, words, param)

local rank = {["mana"] = "manamax", ["life"] = "healthmax"}
local str = nil
local limit = 10

if not rank[param] then
doPlayerSendCancel(cid, "Rank não disponível.")
end

local query = db.getResult("SELECT name FROM players ORDER BY " .. rank[param] .. " DESC;")

for i = 1, limit do
str = str and str .. "," .. query:getDataString("name") or query:getDataString("name")
query:next()
end

doPlayerSendTextMessage(cid, 4, str)
return true
end

 

Em limit vc escolha quantos vão entrar pro rank.

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

  • 0

Não testado.

 

 

function onSay(cid, words, param)

local rank = {["mlkina"] = {"manamax", 4}, ["mlpaly"] = {"healthmax", 3}}
local str = nil
local limit = 10

if not rank[param] then
doPlayerSendCancel(cid, "Rank não disponível.")
end

local query = db.getResult("SELECT name FROM players WHERE vocation = " .. rank[param][2] .. " ORDER BY " .. rank[param][1] .. " DESC;")

for i = 1, limit do
str = str and str .. "," .. query:getDataString("name") or query:getDataString("name")
query:next()
end

doPlayerSendTextMessage(cid, 4, str)
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

puts cara vlw msm resp+

 

 

@edit

 

ai nao tem como modificar o meu script de rank para aparecer do de mana e vida ta aew

 

--------------------------------------------------------------------------------------------------------------------------------------------------

 

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 = 50

local letters_to_next = 25

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` = 2310 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

 

-------------------------------------------------------------------------------------------------------------------------------------------------

se tiver como ;]

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

  • 0

Fiz meio que uma gabiarra, mas ta funcionando.

 

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 = 50
local letters_to_next = 25
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)
--
local str = "Highscore for level\n\n"
local rank = {["mana"] = "manamax", ["life"] = "healthmax"}
if rank[param] then
local str = str .. "Rank " .. param .. " - Nome do Jogador\n"
local query = db.getResult("SELECT name FROM players ORDER BY " .. rank[param] .. " DESC;")
for i = 1, max do
local query2 = db.getResult("SELECT " .. rank[param] .. " FROM players WHERE name = '" .. query:getDataString("name") .. "';")
str = str .. i ..  ". " .. query2:getDataString(rank[param]) .. " - " .. query:getDataString("name") .. "\n"
query:next()
end
return doPlayerPopupFYI(cid, str)
end
--
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` = 2310 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

Link para o comentário
Compartilhar em outros sites

  • 0

usa esse aqui:

 

 

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 = 50
local letters_to_next = 25
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)
--
local str = "Highscore for level\n\n"
local rank = {["mana"] = "manamax", ["life"] = "healthmax"}
if rank[param] then
local str = str .. "Rank " .. param .. " - Nome do Jogador\n"
local query = db.getResult("SELECT name FROM players ORDER BY " .. rank[param] .. " DESC;")
for i = 1, max do
if not query:next() then
return doPlayerPopupFYI(cid, str)
end
local query2 = db.getResult("SELECT " .. rank[param] .. " FROM players WHERE name = '" .. query:getDataString("name") .. "';")
str = str .. i ..  ". " .. query2:getDataString(rank[param]) .. " - " .. query:getDataString("name") .. "\n"
end
return doPlayerPopupFYI(cid, str)
end
--
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` = 2310 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

 

ai não precisa arrumar nada

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...