Page 1 of 1

/whoami command

PostPosted: Wed Jul 02, 2014 15:32
by lightonflux
Hallo there,

sometimes there are strange bugs where e.g. a chest is locked in singleplayer, but the singleplayer can't open it. Or if you are admin of a server and you need to test some ACL-like features, then it is always great to know what your name is.

So a simple command names /whoami just returns our player name.

Re: /whoami command

PostPosted: Wed Jul 02, 2014 17:31
by webdesigner97
/me

Re: /whoami command

PostPosted: Wed Jul 02, 2014 20:39
by kaeza
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_chatcommand("whoami", {
  description = "Tell who you are.",
  params = "",
  func = function(name)
    minetest.chat_send_player(name, "You are "..name.."!")
  end,
})

Re: /whoami command

PostPosted: Thu Jul 03, 2014 01:31
by Wuzzy
I added the “whoami” to my Player tools mod.
Find this mod here: Player tools.

Re: /whoami command

PostPosted: Thu Jul 03, 2014 13:59
by webdesigner97
kaeza 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_chatcommand("whoami", {
  description = "Tell who you are.",
  params = "",
  func = function(name)
    minetest.chat_send_player(name, "You are "..name.."!")
  end,
})

Using /me would be enough. You don't need a mod for that :D

Re: /whoami command

PostPosted: Thu Jul 03, 2014 14:10
by Krock
How about send a random chat message? Works if you have "shout" priv.

Re: /whoami command

PostPosted: Thu Jul 03, 2014 15:53
by Wuzzy
Why are you trying to solve a problem which has already be solved?
Your “solutions” are not what lightonflux wanted.
The “/me” command clutters the chat and also requires the “shout” privilege. Just using a chat messsage also clutters the chat and also requires the “shout” privilege. So both methods are not reliable.
The “whoami” command in the playertools mod does not require any privilege and only affects the chat for the player who issued the command. No other player will be bothered with a chat message.

The only problem with “whoami” is that you currently depend on the server for this to work. I really wish such a command goes straight into Minetest’s builtin by default, so nobody has to install mods.

Re: /whoami command

PostPosted: Thu Jul 03, 2014 16:02
by Calinou
Wuzzy wrote:The only problem with “whoami” is that you currently depend on the server for this to work. I really wish such a command goes straight into Minetest’s builtin by default, so nobody has to install mods.


It's in Carbone's default mod, so any server using Carbone will have it.

It would be nice if minetest_next had it too.