diff --git a/custom-chatcolors/scripting/custom-chatcolors.sp b/custom-chatcolors/scripting/custom-chatcolors.sp index 9aac11f5..736f4f55 100644 --- a/custom-chatcolors/scripting/custom-chatcolors.sp +++ b/custom-chatcolors/scripting/custom-chatcolors.sp @@ -132,13 +132,7 @@ public void OnPluginStart() AddCommandListener(Command_Say, "say"); AddCommandListener(Command_Say, "say_team"); - if (g_hGreenText != null) - 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_hGreenText = CreateConVar("sm_cccgreentext", "1", "Enables greentexting (1 = all, 2 = sm_tag access) (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); //colorForward = CreateGlobalForward("CCC_OnChatColor", ET_Event, Param_Cell); @@ -150,6 +144,8 @@ public void OnPluginStart() loadedForward = CreateGlobalForward("CCC_OnUserConfigLoaded", ET_Ignore, Param_Cell); configReloadedForward = CreateGlobalForward("CCC_OnConfigReloaded", ET_Ignore); + AutoExecConfig(true, "plugin.custom-chatcolors"); + 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); }