mail/onjoin.lua
2019-01-12 22:20:40 +00:00

22 lines
572 B
Lua

minetest.register_on_joinplayer(function(player)
minetest.after(0, function(name)
local unreadflag = false
if mail.messages[name] then
for _, message in ipairs(mail.messages[name]) do
if message.unread then
unreadflag = true
end
end
end
if unreadflag then
minetest.show_formspec(name, "mail:unreadnag",
"size[3,2]" ..
"label[0,0;You have unread messages in your inbox.]" ..
"label[0,0.5;Go there now?]" ..
"button[0.5,0.75;2,1;yes;Yes]" ..
"button_exit[0.5,1.5;2,1;no;No]"
)
end
end, player:get_player_name())
end)