diff --git a/locale/ExpGaming-Core/Core Help File.md b/locale/ExpGaming-Core/Core Help File.md index b139f6b5..d82bc4d0 100644 --- a/locale/ExpGaming-Core/Core Help File.md +++ b/locale/ExpGaming-Core/Core Help File.md @@ -78,7 +78,19 @@ See code for more details. * name = value retured by sudo * returens a list if the data returend by thefunction if any * get_sudo_info(string) - * return either a list or string based on the string boliean + * return either a list or string based on the string boliean +* get_ranks(part) + * returns a list of all the ranks + * part (opt) = part of the rank you want to return ie name +* function get_rank_presets(rank) + * returns the current rank presets + * rank (opt) = rank name if only one rank is needed +* get_ranked_players(rank) + * returns the ranks and online time of every player + * rank (opt) = limits it to only this rank +* get_commands(rank) + * returns all commands that are useable + * rank (opt) = rank name to limt it to what that rank can use ## Other * define_command(name,help,inputs,restriction,event) * Add game commands in a way it does not cause crashes diff --git a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua index 0ee0da4a..abae61d5 100644 --- a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua +++ b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua @@ -76,7 +76,15 @@ function load_command(command) end end) end - +-- returns all the commands in a certain rank restriction +function get_commands(rank) + local rank = rank or 'Owner' + local to_return = {} + for _,command in pairs(global.commands) do + if command.restriction <= string_to_rank(restriction).power then table.insert(to_return,command) end + end + return to_return +end Event.register(-1,function() global.commands = Exp_commands end) Event.register(defines.events.on_player_joined_game,function() for _,command in pairs(Exp_commands) do load_command(command) end end) --Please Only Edit Above This Line----------------------------------------------------------- diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua index 92bbfaca..68f8b119 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua @@ -120,6 +120,16 @@ function find_new_rank(player) if get_rank(player).power <= string_to_rank('mod').power and not player.admin then rank_print(player.name..' needs to be promoted.') end if old_rank.name ~= get_rank(player).name then global.old_ranks[player.index]=old_rank.name end end +-- returns a list with every players current rank, or just the players of the rank given, includes online time +function get_ranked_players(rank) + local to_return = {} + for _,player in paris(game.players) do + if not rank or rank == get_rank(player).name then + table.insert(to_return,{player.name,tick_to_display_format(player.online_time),get_rank(player).name}) set_ending_screen_data + end + end + return to_return +end --Event handlers Event.rank_change = script.generate_event_name() Event.register(-1,function() diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua b/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua index 2e908090..fd11db36 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua @@ -73,7 +73,10 @@ local preset_ranks = { Jail={} } - +-- returns this list, or just one rank if given +function get_rank_presets(rank) + if rank then return global.preset_ranks[rank] else return global.preset_ranks end +end Event.register(-1,function() global.preset_ranks = preset_ranks end) --Please Only Edit Above This Line----------------------------------------------------------- return credits \ No newline at end of file diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua index ecb9bb0f..5096a459 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua @@ -140,6 +140,14 @@ for n,rank in pairs(ranks) do end end end +-- returns a list off all the ranks, return only one part if given +function get_ranks(part) + local to_return = {} + if part then + for _,rank in pairs(global.ranks) do table.insert(to_return,rank[part]) end + else to_return = global.ranks 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-----------------------------------------------------------