custom-chatcolors: greentext for vip only

This commit is contained in:
BotoX 2019-10-11 18:26:48 +02:00
parent 64d3556408
commit 802ef98c0c

View File

@ -132,13 +132,7 @@ public void OnPluginStart()
AddCommandListener(Command_Say, "say"); AddCommandListener(Command_Say, "say");
AddCommandListener(Command_Say, "say_team"); AddCommandListener(Command_Say, "say_team");
if (g_hGreenText != null) g_hGreenText = CreateConVar("sm_cccgreentext", "1", "Enables greentexting (1 = all, 2 = sm_tag access) (First chat character must be \">\")", FCVAR_REPLICATED);
CloseHandle(g_hGreenText);
if (g_hReplaceText != null)
CloseHandle(g_hReplaceText);
g_hGreenText = CreateConVar("sm_cccgreentext", "1", "Enables greentexting (First chat character must be \">\")", FCVAR_REPLICATED);
g_hReplaceText = CreateConVar("sm_cccreplacetext", "1", "Enables text replacing as defined in configs/custom-chatcolorsreplace.cfg", FCVAR_REPLICATED); g_hReplaceText = CreateConVar("sm_cccreplacetext", "1", "Enables text replacing as defined in configs/custom-chatcolorsreplace.cfg", FCVAR_REPLICATED);
//colorForward = CreateGlobalForward("CCC_OnChatColor", ET_Event, Param_Cell); //colorForward = CreateGlobalForward("CCC_OnChatColor", ET_Event, Param_Cell);
@ -150,6 +144,8 @@ public void OnPluginStart()
loadedForward = CreateGlobalForward("CCC_OnUserConfigLoaded", ET_Ignore, Param_Cell); loadedForward = CreateGlobalForward("CCC_OnUserConfigLoaded", ET_Ignore, Param_Cell);
configReloadedForward = CreateGlobalForward("CCC_OnConfigReloaded", ET_Ignore); configReloadedForward = CreateGlobalForward("CCC_OnConfigReloaded", ET_Ignore);
AutoExecConfig(true, "plugin.custom-chatcolors");
LoadConfig(); LoadConfig();
} }
@ -2652,7 +2648,7 @@ public Action Hook_UserMessage(UserMsg msg_id, Handle bf, const players[], int p
} }
} }
if (g_msgText[0] == '>' && GetConVarInt(g_hGreenText) > 0) if (g_msgText[0] == '>' && (GetConVarInt(g_hGreenText) == 1 || (GetConVarInt(g_hGreenText) == 2 && CheckCommandAccess(g_msgAuthor, "sm_tag", ADMFLAG_CUSTOM1))))
{ {
Format(g_msgText, sizeof(g_msgText), "\x0714C800%s", g_msgText); Format(g_msgText, sizeof(g_msgText), "\x0714C800%s", g_msgText);
} }