Ir para conteúdo

[Funcionando] Rank System Ingame Tfs 0.2.10 C/ 1 Erro Help


614uc0

Posts Recomendados

Tipo do script: Rank System

Protocolo (versão do Tibia): 8.70

Servidor utilizado: The Forgotten Server 0.2.10

Nível de experiência:

Adicionais/Informações: Rank System com Ml,Lvl e Skills!

 

Obrigado

 

Consegui um script funcional que eh

talkactions/scripts/ranks.lua

function onSay(cid, words, param)

dofile("./config.lua")

local players = 20 -- The amount of players that is shown in the list

local maxgroupid = 1 -- Players in groups above this is not shown in the list

 

if sqlType == "mysql" then

env = assert(luasql.mysql())

con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))

else -- sqlite

env = assert(luasql.sqlite3())

con = assert(env:connect(sqliteDatabase))

end

 

local str = ""

if param == "level" or param == "exp" or param == "lvl" or param == "" then

cur = assert(con:execute("SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` <= "..maxgroupid.." ORDER BY `experience` DESC LIMIT 0,"..players..";"))

row = cur:fetch({}, "a")

str = "# [Level] - Name - (Experience)\n"

local i = 0

while row do

str = str.."\n#"..(i+1).." ["..row.level.."] - "..row.name.." - ("..row.experience..")"

row = cur:fetch (row, "a")

i = i+1

end

elseif param == "maglevel" or param == "magic" or param == "ml" then

cur = assert(con:execute("SELECT `name`, `maglevel` FROM `players` WHERE `group_id` <= "..maxgroupid.." ORDER BY `maglevel` DESC LIMIT 0,"..players..";"))

row = cur:fetch({}, "a")

str = "# [Magic Level] - Name\n"

local i = 0

while row do

str = str.."\n#"..(i+1).." ["..row.maglevel.."] - "..row.name..""

row = cur:fetch (row, "a")

i = i+1

end

elseif param == "fist" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 0 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [Fist Fighting] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

elseif param == "club" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 1 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [Club Fighting] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

elseif param == "sword" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 2 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [sword Fighting] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

elseif param == "axe" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 3 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [Axe Fighting] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

elseif param == "dist" or param == "distance" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 4 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [Distance Fighting] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

elseif param == "shield" or param == "shielding" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 5 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [shielding] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

elseif param == "fish" or param == "fishing" then

cur = assert(con:execute("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = 6 ORDER BY `value` DESC;"))

row = cur:fetch({}, "a")

str = "# [Fishing] - Name\n"

local i = 0

while row do

if i == players then

break

end

query = assert(con:execute("SELECT `name` FROM `players` WHERE `group_id` <= "..maxgroupid.." AND `id` = "..row.player_id..""))

sql = query:fetch({}, "a")

if sql ~= nil then

str = str.."\n#"..(i+1).." ["..row.value.."] - "..sql.name..""

i = i+1

end

row = cur:fetch (row, "a")

end

end

if str ~= "" then

doPlayerPopupFYI(cid, str)

end

con:close()

env:close()

end

 

talkactions/talkactions.xml

<talkaction words="!ranks" script="highscores.lua"/>

 

Para Usar

Rank Lvl = !rank

Rank ML = !rank "magic

Rank Fist = !rank "fist

Rank Club = !rank "club

Rank Sword = !rank "sword

Rank Axe = !rank "axe

Rank Distance = !rank "distance

Rank Shield = !rank "shield

Rank Fishing = !rank "fishing

 

Ate Agora o Unico que funcionou porem da o seguinte erro

 

Versão = The Forgotten Server - Version 0.2.10 (Mystic Spirit)

[02/07/2011 17:30:04] Lua Script Error: [TalkAction Interface]

[02/07/2011 17:30:04] data/talkactions/scripts/ranks.luanSay

[02/07/2011 17:30:04] data/talkactions/scripts/ranks.lua:158: LuaSQL: there are open cursors

[02/07/2011 17:30:04] stack traceback:

[02/07/2011 17:30:04] [C]: ?

[02/07/2011 17:30:04] [C]: in function 'close'

[02/07/2011 17:30:04] data/talkactions/scripts/ranks.lua:158: in function <data/talkactions/scripts/ranks.lua:1>

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

×
×
  • Criar Novo...