diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-02-15 20:46:43 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-02-15 20:46:43 +0100 |
commit | db0f91aa0a7e9bd085b957be20019ca924306131 (patch) | |
tree | b47f1071f745d318b590c05d7fd382ae160d7849 | |
parent | 6738109c15f53b8f57b711719c2334b1c575bd2e (diff) | |
download | xban2-db0f91aa0a7e9bd085b957be20019ca924306131.tar.gz xban2-db0f91aa0a7e9bd085b957be20019ca924306131.tar.bz2 xban2-db0f91aa0a7e9bd085b957be20019ca924306131.zip |
Added support for non-ban criminal records
-rw-r--r-- | gui.lua | 2 | ||||
-rw-r--r-- | init.lua | 12 |
2 files changed, 12 insertions, 2 deletions
@@ -43,7 +43,7 @@ local function get_record_simple(name) end local record = { } for _, rec in ipairs(e.record) do - local msg = (os.date("%Y-%m-%d %H:%M:%S", rec.time).." | " + local msg = (os.date("%Y-%m-%d %H:%M:%S", rec.time).." | " .. (rec.type or ban).." | " ..(rec.reason or "No reason given.")) table.insert(record, msg) end @@ -69,6 +69,13 @@ function xban.get_info(player) --> ip_name_list, banned, last_record return e.names, e.banned, e.record[#e.record] end +function xban.add_record(player, record) + -- Add records for other punishments banned. + local e = xban.find_entry(player, true) + table.insert(e.record, record) +end + + function xban.ban_player(player, source, expires, reason) --> bool, err if xban.get_whitelist(player) then return nil, "Player is whitelisted; remove from whitelist first" @@ -82,6 +89,7 @@ function xban.ban_player(player, source, expires, reason) --> bool, err time = os.time(), expires = expires, reason = reason, + type = "ban", } table.insert(e.record, rec) e.names[player] = true @@ -124,6 +132,7 @@ function xban.unban_player(player, source) --> bool, err source = source, time = os.time(), reason = "Unbanned", + type = "unban" } table.insert(e.record, rec) e.banned = false @@ -166,7 +175,8 @@ function xban.get_record(player) end local record = { } for _, rec in ipairs(e.record) do - local msg = rec.reason or "No reason given." + local msg = rec.type or "ban" + msg = msg .. ": " .. rec.reason or "No reason given." if rec.expires then msg = msg..(", Expires: %s"):format(os.date("%c", e.expires)) end |