Add the member list in /faction info

This commit is contained in:
Supergoat666 2020-07-28 22:29:38 +02:00
parent d9844f27e4
commit 8e4aa0db51

@ -163,11 +163,22 @@ local function handle_command(name, param)
local faction_name = params[2]
if faction_name == nil then
faction_name = factions.get_player_faction(name)
minetest.chat_send_player(name, S("No faction were given, returning information about your oldest faction (e.g. the oldest created faction you are in)"))
end
if faction_name == nil then
minetest.chat_send_player(name, S("Missing faction name"))
elseif facts[faction_name] == nil then
minetest.chat_send_player(name, S("This faction is not registered"))
else
minetest.chat_send_player(name, S("Owner: @1", factions.get_owner(faction_name)))
local fmembers = ""
for play,_ in pairs(facts[faction_name].members) do
if fmembers == "" then
fmembers = play
else
fmembers = fmembers..", "..play
end
end
minetest.chat_send_player(name, S("Name: @1\nOwner: @2\nMembers: #@3", faction_name, factions.get_owner(faction_name), fmembers))
if factions.get_owner(faction_name) == name then
minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name)))
end