Page 1 of 1

Requesting a partner

PostPosted: Fri Jul 17, 2015 14:22
by chase programer
I have this mod that i cannot figure out i spent a very low amount of time working on it but it is a mod that welcomes the player to the server then shows them a list of who is online I would like some help.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_joinplayer(function(player)
   minetest.chat_send_all(" Welcome to the server "..player:get_player_name().."!")
}


I have tried other code like.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
for _,player in ipairs(minetest.get_connected_players()) do
   local name = player:get_player_name()
   minetest.chat_send_player(name, "Hello " .. name)
end


Still cant figure it out to list the online players.

Re: Requesting a partner

PostPosted: Fri Jul 17, 2015 14:47
by jp
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_joinplayer(function(player)
   local name = player:get_player_name()
   minetest.chat_send_player(name, "Welcome to the server "..name.."!")
end)

Have fun.

Re: Requesting a partner

PostPosted: Fri Jul 17, 2015 14:53
by TenPlus1
When joining a server it already lists the other players already signed on, also typing /status will show who is currently playing... or you could do:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_joinplayer(function(player)
   local name = player:get_player_name()
   minetest.chat_send_all(" Welcome to the server " .. name .. "!")
   local text = " Players connected: "
   minetest.after(2, function()
      for _,player in ipairs(minetest.get_connected_players()) do
         text = text .. player:get_player_name() .. ", "
      end
      minetest.chat_send_player(name, text)
   end)
end)

Re: Requesting a partner

PostPosted: Fri Jul 17, 2015 23:31
by chase programer
jp wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_joinplayer(function(player)
   local name = player:get_player_name()
   minetest.chat_send_player(name, "Welcome to the server "..name.."!")
end)

Have fun.


Thank you both.