From ae8d2e28b816287aeecd5a1a5e9e59f05eb57f80 Mon Sep 17 00:00:00 2001 From: shavit Date: Fri, 14 Sep 2018 17:50:50 +0300 Subject: [PATCH] oops --- addons/sourcemod/scripting/shavit-chat.sp | 35 +++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-chat.sp b/addons/sourcemod/scripting/shavit-chat.sp index 2c212b21..23095a3e 100644 --- a/addons/sourcemod/scripting/shavit-chat.sp +++ b/addons/sourcemod/scripting/shavit-chat.sp @@ -1096,8 +1096,39 @@ bool HasRankAccess(int client, int rank) return false; } - static any aCache[view_as(bCRFree)+1]; - gA_ChatRanks.GetArray(rank, aCache[0], sizeof(aCache)); // a hack to only retrieve up to what we want + any[] aCache = new any[CRCACHE_SIZE]; + gA_ChatRanks.GetArray(rank, aCache, view_as(CRCACHE_SIZE)); + + char[] sFlag = new char[32]; + strcopy(sFlag, 32, aCache[sCRAdminFlag]); + + bool bFlagAccess = false; + int iSize = strlen(sFlag); + + if(iSize == 0) + { + bFlagAccess = true; + } + + else if(iSize == 1) + { + AdminFlag afFlag = view_as(0); + + if(FindFlagByChar(sFlag[0], afFlag)) + { + bFlagAccess = GetAdminFlag(GetUserAdmin(client), afFlag); + } + } + + else + { + bFlagAccess = CheckCommandAccess(client, sFlag, 0, true); + } + + if(!bFlagAccess) + { + return false; + } if(aCache[bCRFree]) {