Skip to content

Commit

Permalink
update core compatible with latest chat-processor version, update inc…
Browse files Browse the repository at this point in the history
…lude files, fix inventory glitch on store_equipment table (#33, #102)
  • Loading branch information
nuclearsilo583 committed Aug 24, 2022
1 parent 2ac8d60 commit 2e31dd7
Show file tree
Hide file tree
Showing 11 changed files with 1,038 additions and 754 deletions.
370 changes: 189 additions & 181 deletions addons/sourcemod/scripting/chat-processor.sp

Large diffs are not rendered by default.

190 changes: 180 additions & 10 deletions addons/sourcemod/scripting/include/chat-processor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,113 @@
#define MAXLENGTH_MESSAGE 128
#define MAXLENGTH_BUFFER 255

////////////////////////////
//Natives

/**
* Retrieves the current format string assigned from a flag string.
* Example: "Cstrike_Chat_All" = "{1} : {2}"
* You can find the config formats in either the translations or the configs.
*
* param sFlag Flag string to retrieve the format string from.
* param sFlag Flag string to retrieve the format string from.
* param sBuffer Format string from the flag string.
* param iSize Size of the format string buffer.
* param iSize Size of the format string buffer.
*
* noreturn
**/
native void ChatProcessor_GetFlagFormatString(const char[] sFlag, char[] sBuffer, int iSize);

/**
* Adds a specific tag to a clients name.
*
* param client Client index.
* param tag Tag buffer.
*
* return True if added, false otherwise.
**/
native bool ChatProcessor_AddClientTag(int client, const char[] tag);

/**
* Removes a specific tag from a clients name.
*
* param client Client index.
* param tag Tag buffer.
*
* return True if found and removed, false otherwise.
**/
native bool ChatProcessor_RemoveClientTag(int client, const char[] tag);

/**
* Swap client tags in place.
*
* param client Client index.
* param tag1 Tag1 buffer.
* param tag2 Tag2 buffer.
*
* return True if both found and swapped, false otherwise.
**/
native bool ChatProcessor_SwapClientTags(int client, const char[] tag1, const char[] tag2);

/**
* Strips all tags from a client.
*
* param client Client index.
*
* return True if tags were found and stripped, false if none were found and stripped.
**/
native bool ChatProcessor_StripClientTags(int client);

/**
* Sets the specific color for a tag.
*
* param client Client index.
* param tag Tag buffer.
* param color Color to use.
*
* return True if found and set, false otherwise.
**/
native bool ChatProcessor_SetTagColor(int client, const char[] tag, const char[] color);

/**
* Sets the specific color for the clients name.
*
* param client Client index.
* param color Color to use.
*
* return True if set, false otherwise.
**/
native bool ChatProcessor_SetNameColor(int client, const char[] color);

/**
* Sets the specific color for the clients messages.
*
* param client Client index.
* param color Color to use.
*
* return True if set, false otherwise.
**/
native bool ChatProcessor_SetChatColor(int client, const char[] color);

////////////////////////////
//Forwards

/**
* Called before a chat message is sent, here the message is already processed.
*
* param sender Author that sent the message.
* param reciver Reciver of the message.
* param flag Message's flag.
* param buffer Message's buffer.
* param maxlength Max length of the buffer.
*
* return types
* - Plugin_Continue Continues the message.
* - Plugin_Changed Continues the message.
* - Plugin_Handled Stops the message.
* - Plugin_Stop Stops the message.
**/
forward Action CP_OnChatMessageSendPre(int sender, int reciever, char[] flag, char[] buffer, int maxlength);

/**
* Called while sending a chat message before It's sent.
* Limits on the name and message strings can be found above.
Expand All @@ -37,10 +129,10 @@ native void ChatProcessor_GetFlagFormatString(const char[] sFlag, char[] sBuffer
* param removecolors Toggle to remove colors in the buffer strings. (Requires bProcessColors = true)
*
* return types
* - Plugin_Continue Stops the message.
* - Plugin_Stop Stops the message.
* - Plugin_Continue Continues 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.
* - Plugin_Stop Stops the message.
**/
forward Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool & processcolors, bool & removecolors);

Expand All @@ -61,21 +153,99 @@ forward Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagst
forward void CP_OnChatMessagePost(int author, ArrayList recipients, const char[] flagstring, const char[] formatstring, const char[] name, const char[] message, bool processcolors, bool removecolors);

/**
* Called before a chat message is sent, here the message is already processed.
* Called after the client has had a new tag added.
*
* param sender Author that sent the message.
* param reciver Reciver of the message.
* param buffer Message's buffer.
* param maxlength Max length of the buffer.
* param client Client index.
* param index Index for the tag.
* param tag The tag itself.
*
* noreturn
**/
forward void CP_OnAddClientTagPost(int client, int index, const char[] tag);

/**
* Called after the client has had a new tag removed.
*
* param client Client index.
* param index Index the tag used to have.
* param tag The tag removed.
*
* noreturn
**/
forward void CP_OnRemoveClientTagPost(int client, int index, const char[] tag);

/**
* Called after the client has had two tags swapped in place.
*
* param client Client index.
* param index1 Index for the first tag.
* param tag1 The first tag itself.
* param index2 Index for the second tag.
* param tag2 The second tag itself.
*
* noreturn
**/
forward void CP_OnSwapClientTagsPost(int client, int index1, const char[] tag1, int index2, const char[] tag2);

/**
* Called after the client had all of their tags stripped.
*
* param client Client index.
*
* noreturn
**/
forward void CP_OnStripClientTagsPost(int client);

/**
* Called after a particular client tags color is set.
*
* param client Client index.
* param index Index for the tag.
* param tag The tag itself.
* param color The color code used.
*
* noreturn
**/
forward void CP_OnSetTagColorPost(int client, int index, const char[] tag, const char[] color);

/**
* Called after a client's name color is set.
*
* param client Client index.
* param color The color code used.
*
* noreturn
**/
forward void CP_OnSetNameColorPost(int client, const char[] color);

/**
* Called after a client's chat color is set.
*
* param client Client index.
* param color The color code used.
*
* noreturn
**/
forward void CP_OnSetChatColorPost(int client, const char[] color);

/**
* Called once the plugin is fully loaded and chat data is ready to be parsed.
*
* noreturn
**/
forward Action CP_OnChatMessageSendPre(int sender, int reciever, char[] buffer, int maxlength);
forward void CP_OnReloadChatData();

#if !defined REQUIRE_PLUGIN
public void __pl_chat_processor_SetNTVOptional()
{
MarkNativeAsOptional("ChatProcessor_GetFlagFormatString");
MarkNativeAsOptional("ChatProcessor_AddClientTag");
MarkNativeAsOptional("ChatProcessor_RemoveClientTag");
MarkNativeAsOptional("ChatProcessor_SwapClientTags");
MarkNativeAsOptional("ChatProcessor_StripClientTags");
MarkNativeAsOptional("ChatProcessor_SetTagColor");
MarkNativeAsOptional("ChatProcessor_SetNameColor");
MarkNativeAsOptional("ChatProcessor_SetChatColor");
}
#endif

Expand Down
Loading

0 comments on commit 2e31dd7

Please sign in to comment.