diff --git a/chatcommands.lua b/chatcommands.lua index 362b31f..6f85051 100755 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -360,7 +360,7 @@ function factions_chat.allfactions_chathandler(playername,parameter) local recipients = {} for faction,value in pairs(factions.get_factions(player)) do - for name,value in pairs(factions.dynamic_data.membertable[faction]) do + for name,val in pairs(factions.dynamic_data.membertable[value]) do local object_to_check = minetest.get_player_by_name(name) if object_to_check ~= nil then @@ -405,16 +405,15 @@ function factions_chat.chathandler(playername,parameter) local valid_faction = false for faction,value in pairs(factions.get_factions(player)) do - if target_faction == faction then + if target_faction == value then valid_faction = true end end - if faction ~= nil and valid_faction and - factions.dynamic_data.membertable[faction] ~= nil then - for name,value in pairs(factions.dynamic_data.membertable[faction]) do + if target_faction ~= nil and valid_faction and + factions.dynamic_data.membertable[target_faction] ~= nil then + for name,value in pairs(factions.dynamic_data.membertable[target_faction]) do local object_to_check = minetest.get_player_by_name(name) - factions_chat.show_help(playername) if object_to_check ~= nil and name ~= playername then minetest.chat_send_player(name,playername ..": " .. text,false) @@ -422,7 +421,7 @@ function factions_chat.chathandler(playername,parameter) end else minetest.chat_send_player(playername, - "Factions: you're not a member of " .. dump(faction),false) + "Factions: you're not a member of " .. dump(target_faction),false) end return end @@ -456,10 +455,10 @@ function factions_chat.show_help(playername) MSG("\tAdmin commands:") MSG("\t\t/factions create -> create a new faction") - MSG("\t\t/factions delete -> delete a faction faction") + MSG("\t\t/factions delete -> delete a faction") MSG("\t\t/factions leave -> remove player from faction") MSG("\t\t/factions invite -> invite player to faction") - MSG("\t\t/factions set_free -> set faction free to join") - MSG("\t\t/factions admin -> make player admin of faction") + MSG("\t\t/factions set_free -> set faction free to join") + MSG("\t\t/factions admin -> make player admin of faction") MSG("\t\t/factions description -> set description for faction") end