Send Chat to Player Who Has Just Joined

davegoopot
Member
 
Posts: 15
Joined: Sat Apr 06, 2013 08:43
GitHub: davegoopot

Send Chat to Player Who Has Just Joined

by davegoopot » Fri Apr 19, 2013 21:15

The wiki says that you can't use minetest.chat_send_player() to send a message to a player who has just joined by registering to minetest.register_on_joinplayer. [1]

My question is: so how can you send a message to a player who has just joined?

[1] http://dev.minetest.net/minetest.register_on_joinplayer

Thanks,

Dave.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Fri Apr 19, 2013 21:55

Minimal uses minetest.after(2) to do that.
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Fri Apr 19, 2013 21:56

the issue is that the player joins before his client has fully loaded, meaning he dosn't see the message. You could try minetest.after, but thats hacky, at best.
 

davegoopot
Member
 
Posts: 15
Joined: Sat Apr 06, 2013 08:43
GitHub: davegoopot

by davegoopot » Sat Apr 20, 2013 08:28

Thanks. I've got something to work using minetest.after. It is a little hacky as you say. Is there an argument for adding another hook that you can register? Something like minetest.minetest.register_on_newplayerready ?

Dave.
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48

by Traxie21 » Sat Apr 20, 2013 13:34

I wish, but there's nothing sent to the server once the client is fully ready afaik. You could check for any keypress once the client loads though, or detect changes in the player's look direction.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron