diff --git a/README.md b/README.md
index a8b00073..08eb12da 100644
--- a/README.md
+++ b/README.md
@@ -15,13 +15,13 @@ a bhop server should be simple
* `clientprefs` plugin/extension. Comes built-in with SourceMod.
* [DHooks](http://users.alliedmods.net/~drifter/builds/dhooks/2.0/) - required for compilation of `shavit-misc`.
* [The RTLer](https://forums.alliedmods.net/showthread.php?p=1649882) is required to *compile* `shavit-chat` and you don't need Simple Chat Processor as listed in Ther RTLer's requirements.
-* [Simple Chat Processor \(Redux\)](https://forums.alliedmods.net/showthread.php?p=1820365) - for compilation and better runtime of `shavit-chat` (plugin can run without it). Use the scp.inc file I attached in `include/scp.inc` for transitional syntax support.
+* [Chat-Processor](https://forums.alliedmods.net/showthread.php?t=286913) - for compilation and better runtime of `shavit-chat` (plugin can run without it).
* [Dynamic](https://forums.alliedmods.net/showthread.php?t=270519) for compilation and runtime of the whole plugin.
# Optional requirements:
* [DHooks](http://users.alliedmods.net/~drifter/builds/dhooks/2.0/) - required for 250/260 prestrafe for all weapons.
* [The RTLer](https://forums.alliedmods.net/showthread.php?p=1649882) - required for properly formatted RTL text within `shavit-chat`.
-* [Simple Chat Processor \(Redux\)](https://forums.alliedmods.net/showthread.php?p=1820365) - for more proper parsing inside `shavit-chat`.
+* [Chat-Processor](https://forums.alliedmods.net/showthread.php?t=286913) - for more proper parsing inside `shavit-chat`.
* `sv_disable_immunity_alpha` set to 1 in CS:GO for `shavit_misc_playeropacity` to work.
# Installation:
diff --git a/scripting/include/chat-processor.inc b/scripting/include/chat-processor.inc
new file mode 100644
index 00000000..c6b22e00
--- /dev/null
+++ b/scripting/include/chat-processor.inc
@@ -0,0 +1,64 @@
+#if defined _chat_processor_included
+ #endinput
+#endif
+#define _chat_processor_included
+
+//Globals
+#define MAXLENGTH_INPUT 128
+#define MAXLENGTH_NAME 64
+#define MAXLENGTH_MESSAGE 256
+
+enum eChatFlags
+{
+ ChatFlag_Invalid,
+ ChatFlag_All,
+ ChatFlag_Team,
+ ChatFlag_Spec,
+ ChatFlag_Dead
+}
+
+//Forwards
+/**
+* Called while sending a chat message before It's sent.
+* Limits on the name and message strings can be found above.
+*
+* param author Author that created the message.
+* param recipients Array of clients who will receive the message.
+* param flag Determines which type of message is being sent.
+* param name Name string of the author to be pushed.
+* param message Message string from the author to be pushed.
+*
+* return types
+* - Plugin_Continue Stops the message.
+* - Plugin_Stop Stops the message.
+* - Plugin_Changed Fires the post-forward below and prints out a message.
+* - Plugin_Handled Fires the post-forward below but doesn't print a message.
+**/
+forward Action OnChatMessage(int& author, ArrayList recipients, eChatFlags& flag, char[] name, char[] message, bool& bProcessColors, bool& bRemoveColors);
+
+/**
+* Called after the chat message is sent to the designated clients by the author.
+*
+* param author Author that sent the message.
+* param recipients Array of clients who received the message.
+* param flag Determines which type of message was sent.
+* param name Name string of the author.
+* param message Message string from the author.
+*
+* noreturn
+**/
+forward void OnChatMessagePost(int author, ArrayList recipients, eChatFlags flag, const char[] name, const char[] message, bool bProcessColors, bool bRemoveColors);
+
+/**
+Shared plugin information
+**/
+public SharedPlugin _pl_chat_processor =
+{
+ name = "chat-processor",
+ file = "chat-processor.smx",
+#if defined REQUIRE_PLUGIN
+ required = 1
+#else
+ required = 0
+#endif
+};
diff --git a/scripting/include/scp.inc b/scripting/include/scp.inc
deleted file mode 100644
index bddd85b8..00000000
--- a/scripting/include/scp.inc
+++ /dev/null
@@ -1,109 +0,0 @@
-/************************************************************************
-*************************************************************************
-Simple Plugins
-Description:
- Included file for Simple Chat Processor in the Simple Plugins project
-*************************************************************************
-*************************************************************************
-This file is part of Simple Plugins project.
-
-This plugin is free software: you can redistribute
-it and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation, either version 3 of the License, or
-later version.
-
-This plugin is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this plugin. If not, see .
-*************************************************************************
-*************************************************************************
-File Information
-$Id$
-$Author$
-$Revision$
-$Date$
-$LastChangedBy$
-$LastChangedDate$
-$URL$
-$Copyright: (c) Simple Plugins 2008-2009$
-*************************************************************************
-*************************************************************************/
-
-#if defined _scp_included
- #endinput
-#endif
-#define _scp_included
-
-#define MAXLENGTH_INPUT 128 // Inclues \0 and is the size of the chat input box.
-#define MAXLENGTH_NAME 64 // This is backwords math to get compability. Sourcemod has it set at 32, but there is room for more.
-#define MAXLENGTH_MESSAGE 256 // This is based upon the SDK and the length of the entire message, including tags, name, : etc.
-
-#define CHATFLAGS_INVALID 0
-#define CHATFLAGS_ALL (1<<0)
-#define CHATFLAGS_TEAM (1<<1)
-#define CHATFLAGS_SPEC (1<<2)
-#define CHATFLAGS_DEAD (1<<3)
-
-/**********************************************************************
- * When a player types a chat message
- *
- * NOTES:
- * Use MAXLENGTH_ constants above for formating the strings
- * Do not rely on the recipients handle to exist beyond the forward
- * Do not start another usermessage (PrintToChat) within this forward
- *
- * @param author The client index of the player who sent the chat message (Byref)
- * @param recipients The handle to the client index adt array of the players who should recieve the chat message
- * @param name The client's name of the player who sent the chat message (Byref)
- * @param message The contents of the chat message (Byref)
- * @noreturn
- **********************************************************************/
-forward Action OnChatMessage(int &author, ArrayList recipients, char[] name, char[] message);
-
-/**********************************************************************
- * Called after all OnChatMessage forwards have been fired and the message is being broadcast.
- *
- * NOTES:
- * Use MAXLENGTH_ constants above for formating the strings
- * Do not rely on the recipients handle to exist beyond the forward
- *
- * @param author The client index of the player who sent the chat message
- * @param recipients The handle to the client index adt array of the players who are receiting the chat message
- * @param name The client's name of the player who sent the chat message (after any replacements)
- * @param message The contents of the chat message (after any replacements)
- * @noreturn
- **********************************************************************/
-forward void OnChatMessage_Post(int author, ArrayList recipients, const char[] name, const char[] message);
-
-/**********************************************************************
- * Gets the current flags for the chat message
- * Should only be called within OnChatMessage() or OnChatMessage_Post()
- *
- * @return The current type of chat message (see constants)
- **********************************************************************/
- native int GetMessageFlags();
-
-/**
-Shared plugin information
-**/
-public SharedPlugin _pl_scp =
-{
- name = "scp",
- file = "simple-chatprocessor.smx",
-#if defined REQUIRE_PLUGIN
- required = 1
-#else
- required = 0
-#endif
-};
-
-#if !defined REQUIRE_PLUGIN
-public void _pl_scp_SetNTVOptional()
-{
- MarkNativeAsOptional("GetMessageFlags");
-}
-#endif
diff --git a/scripting/shavit-chat.sp b/scripting/shavit-chat.sp
index 1f3e6696..838bd2c7 100644
--- a/scripting/shavit-chat.sp
+++ b/scripting/shavit-chat.sp
@@ -27,14 +27,13 @@
#include
#include
#include
-#include
+#include
#pragma newdecls required
#pragma semicolon 1
#pragma dynamic 131072
// cache
-bool gB_SCPFormat = false;
float gF_LastMessage[MAXPLAYERS+1];
char gS_Cached_Prefix[MAXPLAYERS+1][32];
@@ -56,11 +55,10 @@ Dynamic gD_ChatRanks[64]; // limited to 64 chat ranks right now, i really don't
// modules
bool gB_BaseComm = false;
bool gB_RTLer = false;
-bool gB_SCP = false;
+bool gB_ChatProcessor = false;
// game-related
EngineVersion gEV_Type = Engine_Unknown;
-ConVar gCV_Deadtalk = null;
public Plugin myinfo =
{
@@ -92,7 +90,7 @@ public void OnAllPluginsLoaded()
// modules
gB_BaseComm = LibraryExists("basecomm");
gB_RTLer = LibraryExists("rtler");
- gB_SCP = LibraryExists("scp");
+ gB_ChatProcessor = LibraryExists("chat-processor");
}
public void OnPluginStart()
@@ -100,11 +98,6 @@ public void OnPluginStart()
// game specific
gEV_Type = GetEngineVersion();
- if(gEV_Type == Engine_CSGO)
- {
- gCV_Deadtalk = FindConVar("sv_deadtalk");
- }
-
// commands
RegAdminCmd("sm_reloadchat", Command_ReloadChat, ADMFLAG_ROOT, "Reload chat config.");
@@ -170,9 +163,9 @@ public void OnLibraryAdded(const char[] name)
gB_RTLer = true;
}
- else if(StrEqual(name, "scp"))
+ else if(StrEqual(name, "chat-processor"))
{
- gB_SCP = true;
+ gB_ChatProcessor = true;
}
}
@@ -188,9 +181,9 @@ public void OnLibraryRemoved(const char[] name)
gB_RTLer = false;
}
- else if(StrEqual(name, "scp"))
+ else if(StrEqual(name, "chat-processor"))
{
- gB_SCP = false;
+ gB_ChatProcessor = false;
}
}
@@ -498,26 +491,13 @@ public Action Command_ReloadChat(int client, int args)
return Plugin_Handled;
}
-public Action OnChatMessage(int &author, ArrayList recipients, char[] name, char[] message)
+public Action OnChatMessage(int &author, ArrayList recipients, eChatFlags &flag, char[] name, char[] message, bool &bProcessColors, bool &bRemoveColors)
{
- if(!gB_SCP)
+ if(!gB_ChatProcessor)
{
return Plugin_Continue;
}
- if(gB_SCPFormat && (GetMessageFlags() & CHATFLAGS_ALL) > 0 && !IsPlayerAlive(author) && (gEV_Type == Engine_CSS || !gCV_Deadtalk.BoolValue))
- {
- for(int i = 1; i <= MaxClients; i++)
- {
- if(IsValidClient(i, true))
- {
- recipients.Push(i);
- }
- }
-
- gB_SCPFormat = false;
- }
-
char[] sBuffer = new char[255];
char[] sPrefix = new char[32];
@@ -562,7 +542,7 @@ public Action OnChatMessage(int &author, ArrayList recipients, char[] name, char
strcopy(sFormattedText, 255, message);
}
- FormatEx(name, MAXLENGTH_NAME, "%s%s%s", gEV_Type == Engine_CSGO? " ":"", sPrefix, sName);
+ FormatEx(name, MAXLENGTH_NAME, "%s%s%s", (gEV_Type == Engine_CSGO)? " ":"", sPrefix, sName);
strcopy(message, MAXLENGTH_MESSAGE, sFormattedText);
return Plugin_Changed;
@@ -570,14 +550,7 @@ public Action OnChatMessage(int &author, ArrayList recipients, char[] name, char
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
{
- if(gB_SCP)
- {
- gB_SCPFormat = true;
-
- return Plugin_Continue;
- }
-
- if(!IsValidClient(client) || !IsClientAuthorized(client) || (gB_BaseComm && BaseComm_IsClientGagged(client)))
+ if(gB_ChatProcessor || !IsValidClient(client) || !IsClientAuthorized(client) || (gB_BaseComm && BaseComm_IsClientGagged(client)))
{
return Plugin_Continue;
}
diff --git a/scripting/shavit-stats.sp b/scripting/shavit-stats.sp
index 77fec071..1f92f544 100644
--- a/scripting/shavit-stats.sp
+++ b/scripting/shavit-stats.sp
@@ -477,7 +477,7 @@ public Action Timer_DBFailure(Handle timer, any data)
{
int client = GetClientFromSerial(data);
- if(!client)
+ if(client == 0)
{
return Plugin_Stop;
}
@@ -642,7 +642,7 @@ public void SQL_SubMenu_Callback(Database db, DBResultSet results, const char[]
int client = GetClientFromSerial(data);
- if(!client)
+ if(client == 0)
{
return;
}
diff --git a/scripting/shavit-wr.sp b/scripting/shavit-wr.sp
index fe35f190..a9800c96 100644
--- a/scripting/shavit-wr.sp
+++ b/scripting/shavit-wr.sp
@@ -579,7 +579,7 @@ public void SQL_OpenDelete_Callback(Database db, DBResultSet results, const char
return;
}
- if(!client)
+ if(client == 0)
{
return;
}
@@ -730,7 +730,7 @@ public void DeleteConfirm_Callback(Database db, DBResultSet results, const char[
int client = GetClientFromSerial(data);
- if(!client)
+ if(client == 0)
{
return;
}
@@ -756,7 +756,7 @@ public void DeleteAll_Callback(Database db, DBResultSet results, const char[] er
int client = GetClientFromSerial(data);
- if(!client)
+ if(client == 0)
{
return;
}
diff --git a/scripting/shavit-zones.sp b/scripting/shavit-zones.sp
index 771eccaa..a15917d1 100644
--- a/scripting/shavit-zones.sp
+++ b/scripting/shavit-zones.sp
@@ -760,7 +760,7 @@ public void SQL_DeleteZone_Callback(Database db, DBResultSet results, const char
UnloadZones(type);
RefreshZones();
- if(!client)
+ if(client == 0)
{
return;
}
@@ -836,7 +836,7 @@ public void SQL_DeleteAllZones_Callback(Database db, DBResultSet results, const
int client = GetClientFromSerial(data);
- if(!client)
+ if(client == 0)
{
return;
}