From 4ca1ba5c18f6273a62cf1c1e36b224cfe94adda8 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Thu, 11 Apr 2019 17:13:03 +0100 Subject: [PATCH] Added player as an option to list roles command --- locale/en/commands.cfg | 2 +- modules/commands/roles.lua | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index e1cff318..3e2a70c0 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -9,5 +9,5 @@ chelp-format=/__1__ __2__ - __3__ __4__ chelp-alias=Alias: __1__ chelp-out-of-range=__1__ is an invalid page number. roles-higher-role=The role you tried to assign is higher than your highest. -roles-list=All active roles are: +roles-list=All roles are: roles-list-element=__1__, [color=__2__]__3__ \ No newline at end of file diff --git a/modules/commands/roles.lua b/modules/commands/roles.lua index 64bdb74e..4501a822 100644 --- a/modules/commands/roles.lua +++ b/modules/commands/roles.lua @@ -31,9 +31,13 @@ Commands.new_command('unassign-role','Unassigns a role from a player') end) Commands.new_command('list-roles','Lists all roles in they correct order') +:add_param('player',true,'player') :add_alias('lroles','roles') -:register(function(player,raw) +:register(function(player,action_player,raw) local roles = Roles.config.order + if action_player then + roles = Roles.get_player_roles(action_player) + end local message = {'exp-commands.roles-list'} for _,role_name in pairs(roles) do local role = Roles.get_role_by_name(role_name)