From c8e33375a0fe2eb7475803b281c38f8d37757d78 Mon Sep 17 00:00:00 2001 From: Dogan Date: Fri, 1 Nov 2019 00:03:31 +0100 Subject: [PATCH] ConnectAnnounce: undo last commit --- ConnectAnnounce/scripting/ConnectAnnounce.sp | 36 +++++--------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/ConnectAnnounce/scripting/ConnectAnnounce.sp b/ConnectAnnounce/scripting/ConnectAnnounce.sp index 44ffb1a9..24be12b9 100644 --- a/ConnectAnnounce/scripting/ConnectAnnounce.sp +++ b/ConnectAnnounce/scripting/ConnectAnnounce.sp @@ -50,7 +50,7 @@ public void OnPluginStart() RegAdminCmd("sm_joinmsg", Command_JoinMsg, ADMFLAG_CUSTOM1, "Sets a custom message which will be shown upon connecting to the server"); RegAdminCmd("sm_resetjoinmsg", Command_ResetJoinMsg, ADMFLAG_CUSTOM1, "Resets your custom connect message"); - RegAdminCmd("sm_hide_connect_csays", OnToggleHideCsays, ADMFLAG_CUSTOM1, "Toggle blocking connect csay messages"); + RegConsoleCmd("sm_hide_connect_csays", OnToggleHideCsays, "Toggle blocking connect csay messages"); g_hCookieHideCsays = RegClientCookie("csays_blocked", "are csays blocked", CookieAccess_Protected); @@ -76,8 +76,13 @@ public void OnDatabaseConnect(Database db, const char[] error, any data) //---------------------------------------------------------------------------------------------------- public void OnClientCookiesCached(int client) { - if(IsClientAuthorized(client)) - ReadClientCookies(client); + char sBuffer[2]; + GetClientCookie(client, g_hCookieHideCsays, sBuffer, sizeof(sBuffer)); + + if(sBuffer[0] != '\0') + g_bHideCsays[client] = true; + else + g_bHideCsays[client] = false; } //---------------------------------------------------------------------------------------------------- @@ -91,22 +96,6 @@ public void ToggleHideCsays(int client) CPrintToChat(client, "{cyan}[ConnectAnnounce] {white}%s", g_bHideCsays[client] ? "You hid Connect Csay Messages." : "You unhid Connect Csay Messages."); } -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- -public void ReadClientCookies(int client) -{ - char sBuffer[2]; - - if(CheckCommandAccess(client, "", ADMFLAG_CUSTOM1)) - GetClientCookie(client, g_hCookieHideCsays, sBuffer, sizeof(sBuffer)); - - if(sBuffer[0] != '\0') - g_bHideCsays[client] = true; - else - g_bHideCsays[client] = false; -} - //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- @@ -129,12 +118,6 @@ public Action OnToggleHideCsays(int client, int args) //---------------------------------------------------------------------------------------------------- public void ShowSettingsMenu(int client) { - if(!CheckCommandAccess(client, "", ADMFLAG_CUSTOM1)) - { - PrintToChat(client, "[SM] You don't have access to these Settings."); - return; - } - Menu menu = new Menu(MenuHandler_MainMenu); menu.SetTitle("ConnectCsay Settings", client); @@ -495,9 +478,6 @@ public void OnClientPostAdminCheck(int client) if(IsFakeClient(client)) return; - if(AreClientCookiesCached(client)) - ReadClientCookies(client); - if(g_hDatabase == INVALID_HANDLE) return;