diff --git a/core/smn_console.cpp b/core/smn_console.cpp index e5e65962..e89ae1c2 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -706,6 +706,11 @@ static cell_t ReplyToCommand(IPluginContext *pContext, const cell_t *params) return 1; } +static cell_t GetCmdReplyTarget(IPluginContext *pContext, const cell_t *params) +{ + return g_ChatTriggers.GetReplyTo(); +} + REGISTER_NATIVES(consoleNatives) { {"CreateConVar", sm_CreateConVar}, @@ -741,5 +746,6 @@ REGISTER_NATIVES(consoleNatives) {"ClientCommand", sm_ClientCommand}, {"FakeClientCommand", FakeClientCommand}, {"ReplyToCommand", ReplyToCommand}, + {"GetCmdReplySource", GetCmdReplyTarget}, {NULL, NULL} }; diff --git a/core/smn_player.cpp b/core/smn_player.cpp index a5b11d74..83313cad 100644 --- a/core/smn_player.cpp +++ b/core/smn_player.cpp @@ -19,7 +19,7 @@ #include "sourcemod.h" #include -ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY, "Activity display setting (see sourcemod.cfg)"); +ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY|FCVAR_PROTECTED, "Activity display setting (see sourcemod.cfg)"); static cell_t sm_GetClientCount(IPluginContext *pCtx, const cell_t *params) { diff --git a/plugins/basecommands.sp b/plugins/basecommands.sp index 21e4bf38..14343c74 100644 --- a/plugins/basecommands.sp +++ b/plugins/basecommands.sp @@ -42,6 +42,116 @@ public OnPluginStart() RegAdminCmd("sm_rcon", Command_Rcon, ADMFLAG_RCON, "sm_rcon "); RegAdminCmd("sm_cvar", Command_Cvar, ADMFLAG_CONVARS, "sm_cvar [value]"); RegAdminCmd("sm_execcfg", Command_ExecCfg, ADMFLAG_CONFIG, "sm_execcfg "); + RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]"); +} + +#define FLAG_STRINGS 14 +new String:g_FlagNames[FLAG_STRINGS][20] = +{ + "reservation", + "admin", + "kick", + "ban", + "unban", + "slay", + "map", + "cvars", + "cfg", + "chat", + "vote", + "pass", + "rcon", + "cheat" +}; + +FlagsToString(String:buffer[], maxlength, flags) +{ + new String:joins[FLAG_STRINGS][20]; + new total; + + for (new i=0; i 1) { + ReplyToCommand(client, "[SM] %t", "More than one client matches", arg); + return Plugin_Handled; + } + + new flags = GetUserFlagBits(clients[0]); + new String:flagstring[255]; + if (flags == 0) + { + strcopy(flagstring, sizeof(flagstring), "none"); + } else if (flags & ADMFLAG_ROOT) { + strcopy(flagstring, sizeof(flagstring), "root"); + } else { + FlagsToString(flagstring, sizeof(flagstring), flags); + } + + ReplyToCommand(client, "[SM] %t: %s", "Access", flagstring); + + return Plugin_Handled; } public Action:Command_ExecCfg(client, args) diff --git a/plugins/include/console.inc b/plugins/include/console.inc index 5b90e829..0fc4bba0 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -35,6 +35,15 @@ enum QueryCookie QUERYCOOKIE_FAILED = 0, }; +/** + * Reply sources for commands. + */ +enum ReplySource +{ + SM_REPLY_TO_CONSOLE = 0, + SM_REPLY_TO_CHAT = 1, +}; + /** * Console variable query result values. */ @@ -167,6 +176,13 @@ native PrintToConsole(client, const String:format[], any:...); */ native ReplyToCommand(client, const String:format[], any:...); +/** + * Returns the current reply source of a command. + * + * @return ReplySource value. + */ +native ReplySource:GetCmdReplySource(); + /** * Displays usage of an admin command to users depending on the * setting of the sm_show_activity cvar. diff --git a/translations/common.cfg b/translations/common.cfg index 27ed9766..2d351abe 100644 --- a/translations/common.cfg +++ b/translations/common.cfg @@ -39,4 +39,19 @@ { "en" "You cannot target this player." } + + "Name" + { + "en" "Name" + } + + "Access" + { + "en" "Access" + } + + "See console for output" + { + "en" "See console for output." + } }