Skip to content

Instantly share code, notes, and snippets.

@davisonio
Last active March 9, 2022 00:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davisonio/686aba40989419dbdff2 to your computer and use it in GitHub Desktop.
Save davisonio/686aba40989419dbdff2 to your computer and use it in GitHub Desktop.
Get the IP of a player, Minetest command.
minetest.register_chatcommand("ip", {
params = "<name>",
description = "Show the IP of a player",
privs = {server = true},
func = function(name, param)
-- If no playername is specified you will get a help message
if param == "" then
minetest.chat_send_player(name, "Usage: /ip <playername>")
return
end
-- If the player specified does not exist then you will get a message
if minetest.get_player_by_name(param) == nil then
minetest.chat_send_player(name, "The specified player was not found...")
return
end
-- Gets the IP of the player and sends it to the player who used the command
minetest.chat_send_player(name, "IP of ".. param .." is ".. minetest.get_player_ip(param))
end,
})
--TO DO
--Search auth.txt for players with the same IP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment