Add chatplus.send_mail
This commit is contained in:
parent
c3ba03042c
commit
8f7c520067
1 changed files with 16 additions and 12 deletions
|
@ -303,9 +303,23 @@ minetest.register_chatcommand("inbox", {
|
||||||
else
|
else
|
||||||
chatplus.showInbox(name,false)
|
chatplus.showInbox(name,false)
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function chatplus.send_mail(name, to, msg)
|
||||||
|
minetest.log("To: "..to..", From: "..name..", MSG: "..msg)
|
||||||
|
if chatplus.log_handle ~= nil then
|
||||||
|
chatplus.log("To: "..to..", From: "..name..", MSG: "..msg)
|
||||||
|
end
|
||||||
|
if chatplus.players[to] then
|
||||||
|
table.insert(chatplus.players[to].inbox,os.date("%d/%m").." <"..name..">: "..msg)
|
||||||
|
minetest.chat_send_player(name,"Message sent")
|
||||||
|
chatplus.save()
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,"Player "..to.." does not exist")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_chatcommand("mail", {
|
minetest.register_chatcommand("mail", {
|
||||||
params = "name msg",
|
params = "name msg",
|
||||||
description = "mail: add a message to a player's inbox",
|
description = "mail: add a message to a player's inbox",
|
||||||
|
@ -318,17 +332,7 @@ minetest.register_chatcommand("mail", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.log("To: "..to..", From: "..name..", MSG: "..msg)
|
chatplus.send_mail(name, to, msg)
|
||||||
if chatplus.log_handle ~= nil then
|
|
||||||
chatplus.log("To: "..to..", From: "..name..", MSG: "..msg)
|
|
||||||
end
|
|
||||||
if chatplus.players[to] then
|
|
||||||
table.insert(chatplus.players[to].inbox,os.date("%d/%m").." <"..name..">: "..msg)
|
|
||||||
minetest.chat_send_player(name,"Message sent")
|
|
||||||
chatplus.save()
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name,"Player "..to.." does not exist")
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue