From be756398c4246148493a3c3118b202a94ef593a9 Mon Sep 17 00:00:00 2001 From: BotoX Date: Wed, 19 Apr 2017 19:54:18 +0200 Subject: [PATCH] custom-chatcolors: fix !toggletag not loading when user doesn't have sm_tag permission --- custom-chatcolors/scripting/custom-chatcolors.sp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/custom-chatcolors/scripting/custom-chatcolors.sp b/custom-chatcolors/scripting/custom-chatcolors.sp index 94041bd2..363e9eaa 100644 --- a/custom-chatcolors/scripting/custom-chatcolors.sp +++ b/custom-chatcolors/scripting/custom-chatcolors.sp @@ -2432,7 +2432,14 @@ public void OnClientPostAdminCheck(int client) GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth)); KvRewind(g_hConfigFile); - if (!CheckCommandAccess(client, "sm_tag", ADMFLAG_CUSTOM1) || !KvJumpToKey(g_hConfigFile, auth)) + bool found = false; + if (KvJumpToKey(g_hConfigFile, auth)) + { + found = true; + g_bTagToggled[client] = view_as(KvGetNum(g_hConfigFile, "toggled")); + } + + if (!found || !CheckCommandAccess(client, "sm_tag", ADMFLAG_CUSTOM1)) { KvRewind(g_hConfigFile); KvGotoFirstSubKey(g_hConfigFile); @@ -2441,7 +2448,7 @@ public void OnClientPostAdminCheck(int client) AdminFlag flag; char configFlag[2]; char section[32]; - bool found = false; + found = false; do { @@ -2491,7 +2498,7 @@ public void OnClientPostAdminCheck(int client) KvGetString(g_hConfigFile, "tagcolor", clientTagColor, sizeof(clientTagColor)); KvGetString(g_hConfigFile, "namecolor", clientNameColor, sizeof(clientNameColor)); KvGetString(g_hConfigFile, "textcolor", clientChatColor, sizeof(clientChatColor)); - g_bTagToggled[client] = view_as(KvGetNum(g_hConfigFile, "toggled")); + ReplaceString(clientTagColor, sizeof(clientTagColor), "#", ""); ReplaceString(clientNameColor, sizeof(clientNameColor), "#", ""); ReplaceString(clientChatColor, sizeof(clientChatColor), "#", "");