3 minetest.register_on_joinplayer(function(player)
4 local meta = player:get_meta()
5 local welcomed = (meta:get_int("welcomed") == 1)
6 local name = player:get_player_name()
7 pool[name] = minetest.get_us_time()/1000000
9 minetest.chat_send_all("Welcome "..name.." to the server!")
10 meta:set_int("welcomed", 1)
12 minetest.chat_send_all("Welcome back "..name.."!")
16 local death_messages = {
18 " didn't see that coming!",
20 ", that looked painful!",
21 " is pushing up daisies!",
22 " is lucky there are infinite lives!",
28 "'s health bar is looking a little empty!",
29 " turned into a puzzle!",
30 " is in the Aether now!",
33 " dropped their stuff! Go get it!",
34 " is having a fire sale and everything's free!",
36 ", I didn't even know you could have negative health!",
37 " try not to keep dying!",
40 " is seeing how the ground feels!",
44 local leave_messages = {
48 "'s game probably crashed.",
56 minetest.register_on_dieplayer(function(player)
57 local name = player:get_player_name()
58 if (minetest.get_us_time()/1000000)-pool[name] > 0.001 then
59 minetest.chat_send_all(name..death_messages[math.random(1,table.getn(death_messages))])
60 pool[name] = minetest.get_us_time()/1000000
64 minetest.register_on_leaveplayer(function(player)
65 local name = player:get_player_name()
66 minetest.chat_send_all(name..leave_messages[math.random(1,table.getn(leave_messages))])