diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua index 159a4574..17186ebb 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua @@ -38,6 +38,17 @@ function string_to_rank(string) if #found_ranks == 1 then return found_ranks[1] end end end +--converts the name of a group to the group object +function string_to_rank(string) + if type(string) == 'string' then + local found_groups={} + for _,group in pairs(get_rank_groups()) do + if group.name:lower() == string:lower() then return group end + if group.name:lower():find(string:lower()) then table.insert(found_groups,group) end + end + if #found_groups == 1 then return found_groups[1] end + end +end -- surches the rank for a certain allow command function rank_allowed(rank,is_allowed) for _,allow in pairs(rank.allow) do diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua index 8dd2c96e..758e1cd7 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua @@ -260,6 +260,14 @@ function get_ranks(part) else to_return = global.ranks.ranks end return to_return end +-- returns a list off all the groups, return only one part if given +function get_rank_groups(part) + local to_return = {} + if part then + for _,group in pairs(global.ranks.groups) do table.insert(to_return,group[part]) end + else to_return = global.ranks.groups end + return to_return +end -- Move the ranks to the global array Event.register(-1,function() global.ranks = ranks end) --Please Only Edit Above This Line-----------------------------------------------------------