Aimz gave me this ..
replace userinit() inside users.lua
Code:
function userinit()
users = {}
for line in io.lines(conf_dir.."users.cfg") do
if #line > 0 then
local tempUser = {}
for word in string.gmatch(line, "%w+") do
table.insert(tempUser, word)
end
if not tempUser[4] then
tempUser[4] = "user"
end
users[tempUser[2]] = {id = tempUser[1], password=tempUser[3], privilege = tempUser[4], time = tempUser[5], stime = tempUser[6], usgn = tempUser[7], lastlogin = tempUser[8]}
lastUser = lastUser+1
end
end
priv = {}
for line in io.lines(conf_dir.."priv.cfg") do
line = string.sub(line,0,string.len(line)-1)
if #line > 0 then
table.insert(priv, line)
end
end
end
replace modinit() from mods.lua
Code:
function modinit(file)
if (file == nil or type(file) ~= "string") then file = confdir.."mods.cfg" else file = confdir..file end
if not io.open(file) then file = confdir.."mods.cfg" end
for line in io.lines(file) do
if not (string.sub(file, 1, 2) == "--") then
line = string.sub(line,0,string.len(line)-1)
local f = loadfile(modsdir..line..".lua")
if type(f) =="function" then
f = toMod(f())
print("Mod "..line..".lua sucessfully initialized")
else
print("Mod "..line..".lua failed to initialize")
end
end
end
altpriv = {}
for line in io.lines(confdir.."altprivileges.cfg") do
local fn = loadstring("altpriv."..line)
if fn then fn() end
end
acts = {}
acts.default = function(p, typ, cmd) msg2(p, "Error: Command Does Not Exist: "..typ) end
admacts = {}
admacts.default = function(p, typ, cmd) msg2(p, "Error: Admin Command Does Not Exist: "..typ) end
for g, v in pairs(G) do
if type(v) == "function" then
local n = {}
for word in string.gmatch(g, "%w+") do
table.insert(n, word)
end
if n[1] == "act" then
acts[n[2]] = g
elseif n[1] == "adm"then
admacts[n[2]] = g
if not n[3] then n[3] = "user" end
if altpriv[n[2]] then n[3] = altpriv[n[2]] end
tempPriv = {[n[3]] = n[3]}
for i,word in ipairs(adminhierarchy(n[3])) do
tempPriv[word] = word
end
cmd_priv[n[2]] = tempPriv
end
end
end
action = switch(acts)
admin_action = switch(admacts)
end
replace cmdinit() in cmds.lua
Code:
function cmdinit()
for line in io.lines(conf_dir.."cmds.cfg") do
local cmd = {}
line = string.sub(line,0,string.len(line)-1)
--Future: string.split()
for word in string.gmatch(line, "[^%s]+") do
table.insert(cmd, word)
end
local symbol = cmd[1] -- Symbol
local admin = cmd[2] -- Admin or Not
local text = cmd[3] -- What to parse
--[--
if not admin then admin = "false" end
if not text then text = "" end
--]-- Condition Chunk for all cmds to work.
if symbol and admin then
text = string.sub(line, #symbol+#admin+2)
end
if not (string.lower(admin) == "true" or string.lower(admin) == "false") and type(admin) == "string" then
text=admin
admin = false
elseif string.lower(admin) == "true" then
admin = true
else
admin = false
end
cmd_prefix[symbol]={cmd = text, admin = admin}
end
end