feat: dims report / limited user
This commit is contained in:
parent
f60f489df4
commit
4927c6433d
5
cfg.lua
5
cfg.lua
|
|
@ -6,5 +6,10 @@ return {
|
||||||
subscribeLog = true,
|
subscribeLog = true,
|
||||||
admin = true,
|
admin = true,
|
||||||
},
|
},
|
||||||
|
["kashmoney447"] = {
|
||||||
|
subscribeLog = false,
|
||||||
|
admin = false,
|
||||||
|
limited = true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
32
index.lua
32
index.lua
|
|
@ -57,6 +57,30 @@ local cmds = {
|
||||||
|
|
||||||
ch.send(unm, mparts, "rpt")
|
ch.send(unm, mparts, "rpt")
|
||||||
end,
|
end,
|
||||||
|
dims = function(unm, args)
|
||||||
|
tk:refresh()
|
||||||
|
|
||||||
|
local ins = table.insert
|
||||||
|
|
||||||
|
local mparts = {}
|
||||||
|
ins(mparts, { text = "finished generating dimension report!\n" })
|
||||||
|
|
||||||
|
local n, nplrs = 0, 0
|
||||||
|
for _, _ in next, tk.plrs do nplrs = nplrs + 1 end
|
||||||
|
for i, v in pairs(tk.plrs) do
|
||||||
|
local line = string.format("user: %s dim=%s", i, q(v.dimension))
|
||||||
|
n = n + 1
|
||||||
|
if n ~= nplrs then
|
||||||
|
line = line .. "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
ins(mparts, { text = "[" })
|
||||||
|
ins(mparts, { text = "s", color = "aqua" })
|
||||||
|
ins(mparts, { text = "] " .. line })
|
||||||
|
end
|
||||||
|
|
||||||
|
ch.send(unm, mparts, "rpt")
|
||||||
|
end,
|
||||||
unsublog = function(unm, args)
|
unsublog = function(unm, args)
|
||||||
if not cfg.users[unm].subscribeLog then
|
if not cfg.users[unm].subscribeLog then
|
||||||
ch.send(unm, "you're already aren't subscribed!", "users")
|
ch.send(unm, "you're already aren't subscribed!", "users")
|
||||||
|
|
@ -170,11 +194,17 @@ local function processMessage(unm, msg, hidden)
|
||||||
|
|
||||||
local cmd = table.remove(args, 1)
|
local cmd = table.remove(args, 1)
|
||||||
|
|
||||||
if cfg.users[unm] == nil then
|
local user = cfg.users[unm]
|
||||||
|
if user == nil then
|
||||||
ch.reportLog("foreign user " .. unm .. " tries: " .. cmd)
|
ch.reportLog("foreign user " .. unm .. " tries: " .. cmd)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if user.limited and (cmd ~= "dims" and cmd ~= "faketpa" and cmd ~= "help" and cmd ~= "ping") then
|
||||||
|
ch.reportLog("limited user " .. unm .. " tries: " .. cmd)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local handler = cmds[cmd]
|
local handler = cmds[cmd]
|
||||||
if handler then
|
if handler then
|
||||||
ch.reportLog("user " .. unm .. " runs: " .. cmd)
|
ch.reportLog("user " .. unm .. " runs: " .. cmd)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue