local myFile = "data/talkactions/talkactions.xml"
function onSay(cid, words, param, channel)
local commands = {}
local text = "<--Commands-->"
if (io.open(myFile, "r") ~= nil) then
for line in io.lines(myFile) do
if (line:find('words=".*".*')) then
line = string.match(line, 'words=".*".*')
word = string.sub(line, string.find(line, '="') + 2, string.find(line, '" ') - 1)
table.insert(commands, word)
end
end
text = text .. "\n" .. "Found " .. #commands .. " Commands"
for _, i in ipairs(commands) do
text = text .. "\n" .. "-".. i ..""
end
doShowTextDialog(cid, 9932, text)
else
error("File: \"" .. myFile .. "\" not found, please check directory or file.")
end
return TRUE
end