Já testou? Caso não tenha testado, por favor teste.
Existe 2 outras possibilidades. Uma é em C++ e a outra é em Lua, porém a opção em Lua é mais trabalhosa já que precisará de uma tabela
No caso da solução em lua, terá que completar a tabela:
local list = {
[1] = { spellName = "Berserk", spellType = "AREA" },
[2] = { spellName = "Heal Friend", spellType = "HEAL" },
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t, spelltype = {}, ""
for i = 0, getPlayerInstantSpellCount(cid) - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if (spell.level ~= 0) then
if (spell.manapercent > 0) then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local text, prevLevel = "", -1
for i, spell in ipairs(t) do
local line = ""
if (prevLevel ~= spell.level) then
if (i ~= 1) then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
for i = 1, #list do
if spell.name == list[i].spellName then
spelltype = list[i].spellType
end
end
text = text ..
line .. " " .. spell.words .. " - " .. spell.name .. "(" .. spelltype .. ") : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, item.itemid, text)
return true
end