From 2583e7e69eb1b0cb244070008facbd46b6370be2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 16 Mar 2008 22:32:03 +0000 Subject: [PATCH] removed debug output fixed an antiflood bug posted on the forums --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401940 --- core/ChatTriggers.cpp | 13 +++++++++++-- plugins/antiflood.sp | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/ChatTriggers.cpp b/core/ChatTriggers.cpp index c0b00aae..cf6baa36 100644 --- a/core/ChatTriggers.cpp +++ b/core/ChatTriggers.cpp @@ -185,12 +185,21 @@ void ChatTriggers::OnSayCommand_Pre() { CCommand command; #endif - int client = g_ConCmds.GetCommandClient(); + int client; + CPlayer *pPlayer; + + client = g_ConCmds.GetCommandClient(); m_bIsChatTrigger = false; m_bWasFloodedMessage = false; /* The server console cannot do this */ - if (client == 0) + if (client == 0 || (pPlayer = g_Players.GetPlayerByIndex(client)) == NULL) + { + RETURN_META(MRES_IGNORED); + } + + /* We guarantee the client is connected */ + if (!pPlayer->IsConnected()) { RETURN_META(MRES_IGNORED); } diff --git a/plugins/antiflood.sp b/plugins/antiflood.sp index c965745a..ae39c1e6 100644 --- a/plugins/antiflood.sp +++ b/plugins/antiflood.sp @@ -72,8 +72,6 @@ public bool:OnClientFloodCheck(client) return false; } - PrintToServer("OCFC: %f %f %d", g_LastTime[client], GetGameTime(), g_FloodTokens[client]); - if (g_LastTime[client] > GetGameTime()) { /* If player has 3 or more flood tokens, block their message */ @@ -97,8 +95,6 @@ public OnClientFloodResult(client, bool:blocked) new Float:curTime = GetGameTime(); new Float:newTime = curTime + max_chat; - PrintToServer("OCFR: %f, %f", g_LastTime[client], GetGameTime()); - if (g_LastTime[client] > curTime) { /* If the last message was blocked, update their time limit */