E identação, nada, né?
Tenho notado que você tem desenvolvido muita coisa usando string.gmatch, e acho isso muito legal, mas que tal aprender algo novo e, bem, inovar?
Por caotic, 28 de jan. de 2013 em Actions e Talkactions
E identação, nada, né?
Tenho notado que você tem desenvolvido muita coisa usando string.gmatch, e acho isso muito legal, mas que tal aprender algo novo e, bem, inovar?
info
Grupo: Infante
Registrado: 04/03/11
Posts: 1.6k
Reputação: +393
Char no Tibia: No Have

E identação, nada, né? Tenho notado que você tem desenvolvido muita coisa usando string.gmatch, e acho isso muito legal, mas que tal aprender algo novo e, bem, inovar?
Nada melhor do que usar string.gmatch.
Eheuhaeuhaue
info
Grupo: Infante
Registrado: 04/03/11
Posts: 1.6k
Reputação: +393
Char no Tibia: No Have
Ola galera do xtibia.
function onSay(cid, words, param, channel) function getTalksByGroup(cid) local events = io.open("data/talkactions/talkactions.xml", "r") str = "" for i in events:read("*a"):gmatch('<talkaction(.-)/>') do local acess = tonumber(i:match('access="(.-)"')) local talk = tostring(i:match('words="(.-)"')) local acess = acess or 0 if not string.find(tostring(i), "access") then str = ""..str.."\n"..talk.."- Player" elseif getPlayerGroupId(cid) >= acess then str = ""..str.."\n"..talk.." - "..acess.."" end end return str end function getSpellVocation(cid) local events = io.open("data/spells/spells.xml", "r") str = " >---Spell Vocations "..getPlayerVocation(cid).."---< " for i in events:read("*a"):gmatch('<instant(.-)</instant>') do local name = tostring(i:match('name="(.-)"')) local level = tostring(i:match('lvl="(.-)"')) local words = tostring(i:match('words="(.-)"')) if getPlayerGroupId(cid) >= 5 or getPlayerVocation(cid) == 0 then str = ""..str.."\n"..name.."-"..level.."-"..words.."" elseif string.find(i, '<vocation id="'..getPlayerVocation(cid)..'"/>') then str = ""..str.."\n"..name.."-"..level.."-"..words.."" end end return str end if param == "" or not param then return doPlayerPopupFYI(cid, "Diga se quer ver a sua lista de spell(/commands spells) ou comandos(/commands talks)") end if param == "spell" or param == "spells" then doShowTextDialog(cid, 1949, getSpellVocation(cid)) return true end if param == "talk" or param == "talks" then doShowTextDialog(cid, 1949, getTalksByGroup(cid)) return true end return true endAgora vá em talkactions.xml e coloque esta tag:
List talks/spells e um sistema completo que monstra uma lista que monstra a lista de talks ou a lista de spells.
Na lista de spell e exibido todas as spells da vocação do player e com informações do level da spell,nome da spell e words da spell.
Na lista de talkactions e exibido todas as talks do grupo do player.
Para ver a lista de cada um e só dizer.
Agora vamos ao sistema.
Crie um arquivo lua chamado de commands em talkactions e coloque isto:
Editado Janeiro 28 por caotic