/whoami command

User avatar
lightonflux
Member
 
Posts: 384
Joined: Mon Nov 11, 2013 07:22
In-game: lof

/whoami command

by lightonflux » Wed Jul 02, 2014 15:32

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.
 

User avatar
webdesigner97
Member
 
Posts: 1307
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97

Re: /whoami command

by webdesigner97 » Wed Jul 02, 2014 17:31

/me
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: /whoami command

by kaeza » Wed Jul 02, 2014 20:39

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,
})
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: /whoami command

by Wuzzy » Thu Jul 03, 2014 01:31

I added the “whoami” to my Player tools mod.
Find this mod here: Player tools.
 

User avatar
webdesigner97
Member
 
Posts: 1307
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97

Re: /whoami command

by webdesigner97 » Thu Jul 03, 2014 13:59

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
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: /whoami command

by Krock » Thu Jul 03, 2014 14:10

How about send a random chat message? Works if you have "shout" priv.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: /whoami command

by Wuzzy » Thu Jul 03, 2014 15:53

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.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: /whoami command

by Calinou » Thu Jul 03, 2014 16:02

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.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 2 guests