2020-04-11 03:15:26 +02:00
|
|
|
local sc = smart_chat
|
|
|
|
local S = sc.S
|
2020-04-17 13:44:52 +02:00
|
|
|
local cname = "where"
|
|
|
|
local short = "w"
|
|
|
|
local activate = minetest.settings:get_bool("smart_chat.cmd_" .. cname, true)
|
|
|
|
|
|
|
|
if(not activate) then return end
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
sc.register_help({
|
2020-04-17 13:44:52 +02:00
|
|
|
Name = cname,
|
|
|
|
Usage = "/c " .. cname .. " <name>",
|
2020-04-11 03:15:26 +02:00
|
|
|
Description = S("Show's the room, where <name> is."),
|
|
|
|
Parameter = "<>",
|
2020-04-17 13:44:52 +02:00
|
|
|
Shortcut = "/c " .. short .. " <name>",
|
2020-04-11 03:15:26 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2020-04-17 13:44:52 +02:00
|
|
|
sc[cname] = function(player, parameter)
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(parameter[2] == "" or parameter[2] == nil) then
|
2020-04-12 03:05:38 +02:00
|
|
|
sc.print(player, sc.red .. S("Error: No name given."))
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
local pname = parameter[2]
|
|
|
|
local channel = sc.player[pname]
|
|
|
|
|
|
|
|
if(minetest.get_player_by_name(pname)) then
|
|
|
|
local room = sc.player[pname]
|
|
|
|
if(room ~= nil) then
|
|
|
|
sc.print(player, sc.green .. S("Player [") .. sc.orange .. pname
|
2020-04-11 16:17:01 +02:00
|
|
|
.. sc.green .. S("] is in Channel {")
|
2020-04-11 03:15:26 +02:00
|
|
|
.. sc.yellow .. channel .. sc.green .. "}.")
|
|
|
|
|
|
|
|
else
|
|
|
|
sc.print(player, sc.green .. S("Player [") .. sc.orange .. pname
|
|
|
|
.. sc.green .. S("] is in the public Chat."))
|
|
|
|
|
|
|
|
end -- if(room ~= nil)
|
|
|
|
|
|
|
|
else -- if(minetest.get_player_by_name
|
|
|
|
sc.print(player, sc.red .. S("Error: Player is not online."))
|
|
|
|
|
|
|
|
end -- if(minetest.get_player_by_name
|
|
|
|
|
|
|
|
end -- if(paramter[2]
|
|
|
|
|
|
|
|
end -- sc["where"
|
|
|
|
|
2020-04-17 13:44:52 +02:00
|
|
|
sc[short] = function(player, parameter)
|
2020-04-11 03:15:26 +02:00
|
|
|
|
2020-04-17 13:44:52 +02:00
|
|
|
sc[cname](player, parameter)
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
end -- sc["w"
|