Lua:
local inputFolder = "data/talkactions/scripts/"
local outputFolder = "mods/"
local myFile = "data/talkactions/talkactions.xml"
local function NahrutoFTW()
local files, words, names = {}, {}, {}
if io.open(myFile, "r") then
for line in io.lines(myFile) do
if (line:find('script') and not (line:find("<!--"))) then
f = line:match('value=".*".*')
file = f:sub(f:find('="') + 2, f:find('.lua') - 1)
table.insert(files, file)
w = line:match('words=".*".*')
word = w:sub(w:find('="') + 2,w:find('" ') - 1)
table.insert(words, word)
n = line:match('words=".*".*')
n_ = n:find('/') == 8 and 3 or 2
name = n:sub(n:find('="') + n_, n:find('" ') - 1)
table.insert(names, name)
end
end
end
return {files = files, words = words, names = names}
end
function onSay(cid, words, param, channel)
local transform = NahrutoFTW()
for k, file in ipairs(transform.files) do
local _if, _end, endCount, text = 0, 0, 0, ""
local file = inputFolder .. file .. ".lua"
local open = io.open(file, "r")
if open then
for i in io.lines(file) do
if (i:find("if")) then _if = _if + 1 end
if (i:find("end")) then _end = _end + 1 end
end
for i in io.lines(file) do
if (i:find("end")) then endCount = endCount + 1 end
if not (i:find("function onSay")) and endCount < _end then
text = text .. "\n" .. i
end
end
open:close()
end
local open = io.open(outputFolder .. transform.names[k] .. ".xml", "w")
if open then
open:write('<?xml version="1.0" encoding="UTF-8"?>\n<mod name="' .. transform.names[k] .. '" version="1.0" author="Nahruto\'s Scripts to Mods transformer" contact="in my house" enabled="yes">\n<talkaction words="' .. transform.words[k] .. '" event="buffer"><![CDATA[' .. text .. '\n]]></talkaction>\n</mod>')
open:close()
end
end
return true
end
yeah bitchas, this will transform your current scripts (talkactions for test) to mods mode, is not bug free, i dont know how to add access shit in mods so someone tellme and i will add it, tell me the bugs to make it perfect.