added amb968 - setting for suppressing potential chat triggers from admins
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401800
This commit is contained in:
parent
d87e00a82d
commit
c9a9826989
@ -47,6 +47,15 @@
|
||||
*/
|
||||
"SilentChatTrigger" "/"
|
||||
|
||||
/**
|
||||
* If a say command is a silent chat trigger, and is used by an admin,
|
||||
* but it does not evaluate to an actual command, it will be displayed
|
||||
* publicly. This setting allows you to suppress accidental typings.
|
||||
*
|
||||
* The default value is "no". A value of "yes" will supress.
|
||||
*/
|
||||
"SilentFailSuppress" "no"
|
||||
|
||||
/**
|
||||
* Password setinfo key that clients must set. You must change this in order for
|
||||
* passwords to work, for security reasons.
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "ChatTriggers.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "ConCmdManager.h"
|
||||
#include <IPlayerHelpers.h>
|
||||
#include "PlayerManager.h"
|
||||
|
||||
/* :HACKHACK: We can't SH_DECL here because ConCmdManager.cpp does.
|
||||
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
||||
@ -54,6 +54,7 @@ extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegat
|
||||
#endif //ORANGEBOX_BUILD
|
||||
|
||||
ChatTriggers g_ChatTriggers;
|
||||
bool g_bSupressSilentFails = false;
|
||||
|
||||
ChatTriggers::ChatTriggers() : m_pSayCmd(NULL), m_bWillProcessInPost(false),
|
||||
m_bTriggerWasSilent(false), m_ReplyTo(SM_REPLY_CONSOLE)
|
||||
@ -85,12 +86,19 @@ ConfigResult ChatTriggers::OnSourceModConfigChanged(const char *key,
|
||||
m_PubTrigger = sm_strdup(value);
|
||||
m_PubTriggerSize = strlen(m_PubTrigger);
|
||||
return ConfigResult_Accept;
|
||||
} else if (strcmp(key, "SilentChatTrigger") == 0) {
|
||||
}
|
||||
else if (strcmp(key, "SilentChatTrigger") == 0)
|
||||
{
|
||||
delete [] m_PrivTrigger;
|
||||
m_PrivTrigger = sm_strdup(value);
|
||||
m_PrivTriggerSize = strlen(m_PrivTrigger);
|
||||
return ConfigResult_Accept;
|
||||
}
|
||||
else if (strcmp(key, "SilentFailSuppress") == 0)
|
||||
{
|
||||
g_bSupressSilentFails = strcmp(value, "yes") == 0;
|
||||
return ConfigResult_Accept;
|
||||
}
|
||||
|
||||
return ConfigResult_Ignore;
|
||||
}
|
||||
@ -205,6 +213,15 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
*/
|
||||
if (!PreProcessTrigger(engine->PEntityOfEntIndex(client), args, is_quoted))
|
||||
{
|
||||
CPlayer *pPlayer;
|
||||
if (is_silent
|
||||
&& g_bSupressSilentFails
|
||||
&& client != 0
|
||||
&& (pPlayer = g_Players.GetPlayerByIndex(client)) != NULL
|
||||
&& pPlayer->GetAdminId() != INVALID_ADMIN_ID)
|
||||
{
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user