Chat Processor

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Chat Processor

Postby decompile » Mon Aug 29, 2016 9:54 am

Hello Guys,

I think its time that we need an 'chat processor' plugin with an api, so we can modify the chat by our own.
It would be great for ranking plugins, admin chat colors and more.

It should work for every game, which supports SayText2, since thats probably the most used one.

It should probably give other plugins the usage of:

- OnChatMessage
and
- OnChatMessagePost

Would be awesome if this exists.

EDIT:

After googling around, I saw that a new "Chat processor" plugin has been published on sourcemod forums, which is a new & fixed version of an older chat processor.

It supports every SayText2 game, and allows to easily modify names & messages.

https://forums.alliedmods.net/showthread.php?t=286913

https://github.com/Drixevel/Chat-Processor
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Chat Processor

Postby iPlayer » Mon Aug 29, 2016 10:15 am

Sounds more like a custom package to me
But overall is a very nice idea, because chat modifying can turn out to be a very nested process with many little things that scripter would need to keep in mind. Having a custom package that handles it will help unify it.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Chat Processor

Postby decompile » Mon Aug 29, 2016 10:54 am

Oh ye,

I actually meant custom package, but cause of the forum section name it was still in my mind :P
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Re: Chat Processor

Postby BackRaw » Mon Aug 29, 2016 1:47 pm

I'm interested in trying out this idea. But I'll need a usage example - I'm not sure, but maybe something like this:

Syntax: Select all

from processors.chat import OnChatMessage

@OnChatMessage(cmd="votemap")
def on_chat_message_votemap(player, args):
if args:
# process args, e.g. directly add the first argument to the voting list if it is a correct map name
else:
# send VoteMap menu to player

# I'm not sure, but is HERE where you would call every OnChatMessagePost(cmd="votemap") function?


# ADMIN is not defined anywhere, it's just a hint of how it *could* work
@OnChatMessage(cmd="setmap", auth=ADMIN)
def on_chat_message_setmap(player, args):
# auth=ADMIN handles checking if the player typing the command is an actual admin
# tho this could be done using TypedSayCommand, but I'm currently not quite sure how

# change the map to the first argument if it is a correct map name
Or more like this:

Syntax: Select all

from processors.chat import OnChatMessage

@OnChatMessage(cmd="votemap")
def on_chat_message_votemap(player, mapname):
# add the 'mapname' to the voting list
# it is an actual map name because ChatProcessor already figured that out in the background


Please tell me if I'm totally wrong with this or if this is what you would expect the package to do. :D
User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Re: Chat Processor

Postby Doldol » Mon Aug 29, 2016 3:10 pm

SayFilter and SayCommand?

While having read viewtopic.php?f=20&t=1138

Why is an additional library needed?
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Chat Processor

Postby decompile » Mon Aug 29, 2016 3:18 pm

You guys probably understood it wrong. The main thing of the plugin would be the modification of a "player chat message".

A example code from the sourcemod version is that you can use:

Code: Select all

public Action OnChatMessage(int& author, Handle recipients, eChatFlags& flag, char[] name, char[] message, bool& bProcessColors, bool& bRemoveColors)
{
   Format(name, MAXLENGTH_NAME, "{red}%s", name);
   Format(message, MAXLENGTH_MESSAGE, "{blue}%s", message);
   return Plugin_Changed;
}

public void OnChatMessagePost(int author, Handle recipients, eChatFlags flag, const char[] name, const char[] message, bool bProcessColors, bool bRemoveColors)
{
   PrintToServer("[TEST] %s: %s [%b/%b]", name, message, bProcessColors, bRemoveColors);
}


as an example

EDIT:

first of all, it would support all games (You can see I want to use this for CS:S & CS:GO, but both versions use different message things like protobuf etc) and i rather want to have a custom package for this. (API)
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Chat Processor

Postby iPlayer » Mon Aug 29, 2016 3:54 pm

I'd rather make it so the callback function would return the new message or a tuple defining a new message (cause as far as I remember, message can be defined in both message name and one of the params).
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Re: Chat Processor

Postby BackRaw » Thu Sep 08, 2016 6:24 pm

iPlayer wrote:I'd rather make it so the callback function would return the new message or a tuple defining a new message (cause as far as I remember, message can be defined in both message name and one of the params).

Let's compete :D haha

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 7 guests