Fixed Some Bugs

This commit is contained in:
Cooldude2606
2017-08-20 21:01:56 +01:00
parent 8e54a1d8bb
commit 7d02a52e2b
3 changed files with 6 additions and 3 deletions

View File

@@ -82,7 +82,7 @@ See code for more details.
* 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)
* get_rank_presets(rank)
* returns the current rank presets
* rank (opt) = rank name if only one rank is needed
* get_ranked_players(rank)

View File

@@ -81,7 +81,10 @@ 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
local temp_restriction = nil
if type(command.restriction) == 'number' then temp_restriction = command.restriction end
local restriction = temp_restriction or string_to_rank(command.restriction).power or 0
if restriction > string_to_rank(rank).power then table.insert(to_return,command) end
end
return to_return
end

View File

@@ -123,7 +123,7 @@ 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
for _,player in pairs(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})
end