Skip to content

Commit 1a175c6

Browse files
committedFeb 27, 2015
Add /setpassword and /clearpassword logging
1 parent d4a6ded commit 1a175c6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
 

Diff for: ‎builtin/game/chatcommands.lua

+15-5
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,28 @@ core.register_chatcommand("setpassword", {
229229
if not toname then
230230
return false, "Name field required"
231231
end
232-
local actstr = "?"
232+
local act_str_past = "?"
233+
local act_str_pres = "?"
233234
if not raw_password then
234235
core.set_player_password(toname, "")
235-
actstr = "cleared"
236+
act_str_past = "cleared"
237+
act_str_pres = "clears"
236238
else
237239
core.set_player_password(toname,
238240
core.get_password_hash(toname,
239241
raw_password))
240-
actstr = "set"
242+
act_str_past = "set"
243+
act_str_pres = "sets"
241244
end
242245
if toname ~= name then
243246
core.chat_send_player(toname, "Your password was "
244-
.. actstr .. " by " .. name)
247+
.. act_str_past .. " by " .. name)
245248
end
246-
return true, "Password of player \"" .. toname .. "\" " .. actstr
249+
250+
core.log("action", name .. " " .. act_str_pres
251+
.. " password of " .. toname .. ".")
252+
253+
return true, "Password of player \"" .. toname .. "\" " .. act_str_past
247254
end,
248255
})
249256

@@ -257,6 +264,9 @@ core.register_chatcommand("clearpassword", {
257264
return false, "Name field required"
258265
end
259266
core.set_player_password(toname, '')
267+
268+
core.log("action", name .. " clears password of " .. toname .. ".")
269+
260270
return true, "Password of player \"" .. toname .. "\" cleared"
261271
end,
262272
})

0 commit comments

Comments
 (0)
Please sign in to comment.