Requesting a partner

chase programer
Member
 
Posts: 117
Joined: Thu Jan 03, 2013 16:56

Requesting a partner

by chase programer » Fri Jul 17, 2015 14:22

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.
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: Requesting a partner

by jp » Fri Jul 17, 2015 14:47

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.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Requesting a partner

by TenPlus1 » Fri Jul 17, 2015 14:53

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)
 

chase programer
Member
 
Posts: 117
Joined: Thu Jan 03, 2013 16:56

Re: Requesting a partner

by chase programer » Fri Jul 17, 2015 23:31

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.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron