aboutsummaryrefslogtreecommitdiff
path: root/builtin/chatcommands.lua
diff options
context:
space:
mode:
authorWeblate <42@minetest.ru>2013-04-07 13:39:28 +0200
committerWeblate <42@minetest.ru>2013-04-07 13:39:28 +0200
commitfeb7de91ec34ef1ca3152270a7bc62b2e308f1bd (patch)
tree65c33378bae9b7ac565b979237b6d594b511171f /builtin/chatcommands.lua
parent33052abf42886ef03c4f46196cab6f767259a672 (diff)
parent4468ea84e6d0faede5a01e8d97d359c537aa7ec8 (diff)
downloadminetest-feb7de91ec34ef1ca3152270a7bc62b2e308f1bd.tar.gz
minetest-feb7de91ec34ef1ca3152270a7bc62b2e308f1bd.tar.bz2
minetest-feb7de91ec34ef1ca3152270a7bc62b2e308f1bd.zip
Merge remote branch 'origin/master'
Diffstat (limited to 'builtin/chatcommands.lua')
-rw-r--r--builtin/chatcommands.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua
index 4b09f7b2b..9f14749f4 100644
--- a/builtin/chatcommands.lua
+++ b/builtin/chatcommands.lua
@@ -665,3 +665,23 @@ minetest.register_chatcommand("clearobjects", {
minetest.chat_send_all("*** Cleared all objects.")
end,
})
+
+minetest.register_chatcommand("msg", {
+ params = "<name> <message>",
+ description = "Send a private message",
+ privs = {shout=true},
+ func = function(name, param)
+ local found, _, sendto, message = param:find("^([^%s]+)%s(.+)$")
+ if found then
+ if minetest.env:get_player_by_name(sendto) then
+ minetest.log("action", "PM from "..name.." to "..sendto..": "..message)
+ minetest.chat_send_player(sendto, "PM from "..name..": "..message)
+ minetest.chat_send_player(name, "Message sent")
+ else
+ minetest.chat_send_player(name, "The player "..sendto.." is not online")
+ end
+ else
+ minetest.chat_send_player(name, "Invalid usage, see /help msg")
+ end
+ end,
+})