Modifying chat with sayfilter but SayCommand doesnt "register"

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Mon Jan 23, 2017 12:07 am

Are you sure?

I reproduced it by joining the empty server:

Console => "spectate" => "say hi" =>

Code: Select all

] say hi
*ZUSCHAUER* frag :  hi


=> sp plugin load deadchat => "say hi" =>

Code: Select all

] say hi
*ZUSCHAUER* frag :  hi
*ZUSCHAUER* frag :  hi


I disabled sourcemod for that test, so it must be pretty much that plugin.
Windows10/CSS

More testing with bots:

added 10 bots to both teams:

Writing "say_team hi" prints only once, but console spams:

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\deadchat\deadchat_css.py", line 36, in pre_saytext2_filter
    recipient_filter.update(PlayerIter('ct'))

AttributeError: '_RecipientFilter' object has no attribute 'update'
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby L'In20Cible » Mon Jan 23, 2017 12:24 am

decompile wrote:Are you sure?

I reproduced it by joining the empty server:

Console => "spectate" => "say hi" =>

Code: Select all

] say hi
*ZUSCHAUER* frag :  hi


=> sp plugin load deadchat => "say hi" =>

Code: Select all

] say hi
*ZUSCHAUER* frag :  hi
*ZUSCHAUER* frag :  hi


I disabled sourcemod for that test, so it must be pretty much that plugin.
Windows10/CSS

Followed those steps, I'm not getting it twice:

Code: Select all

] kill
L'In20Cible suicided.
Scoring will not start until both teams have players
Achievements disabled: cheats turned on in this app session.
] say hi
*DEAD* L'In20Cible :  hi
rcon plugin load deadchat
[SP] Loading plugin 'deadchat'...
Searching for a cached signature...
Found a cached signature!
[SP] Successfully loaded plugin 'deadchat'.
] say hi
*DEAD* L'In20Cible :  hi


decompile wrote:More testing with bots:

added 10 bots to both teams:

Writing "say_team hi" prints only once, but console spams:

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\deadchat\deadchat_css.py", line 36, in pre_saytext2_filter
    recipient_filter.update(PlayerIter('ct'))

AttributeError: '_RecipientFilter' object has no attribute 'update'
Yes, this is what I explained in my previous post.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Mon Jan 23, 2017 1:03 am

I tried it:

Code: Select all

] kill
frag suicided.
] say hi
*TOT* frag :  hi
] rcon sp plugin load deadchat
[SP] Loading plugin 'deadchat'...
[SP] Successfully loaded plugin 'deadchat'.
] say hi
*TOT* frag :  hi
*TOT* frag :  hi


Windows 10 / Dedicated Windows CSS Server / No Plugins loaded except source-python itself.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby L'In20Cible » Mon Jan 23, 2017 1:08 am

decompile wrote:No Plugins loaded except source-python itself.

Any SP plugins that use SayFilter/SayCommand by any chance?
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Mon Jan 23, 2017 1:13 am

Nope, nothing except that one plugin.

It works fine with say_team, only when being dead in a team does print multiple times.

Noticed that in the console it also says prints one "*DEAD* frag: whaddup" instead of two ingame.

Maybe it has something to do with the PlayerIter, where it prints again tomyself due writing the message, and once being in the PlayerIter.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby satoon101 » Mon Jan 23, 2017 1:21 am

Do you have SourceMod or EventScripts installed? I know this issue used to appear sometimes when both of those were installed together. Maybe we have that same issue with one or both of them.
Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Mon Jan 23, 2017 1:23 am

I have Sourcemod/Metamod installed, but I havent used or more disabled them when I tested them. (Removing the .vdf so they doesnt load)
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby L'In20Cible » Mon Jan 23, 2017 1:31 am

satoon101 wrote:Do you have SourceMod or EventScripts installed? I know this issue used to appear sometimes when both of those were installed together. Maybe we have that same issue with one or both of them.

This issue was caused by EventScript's SayFilter that was forcing the client to re-execute the say/say_team command when the given text was modified. I don't think this is an issue we have, since we modify the CCommand directly and pass it on to the original callback. However, I'm really unable to reproduce this issue on my end so there is definitely something conflicting. It cannot be the filter adding the same player twice, since we exit the call if the index is already in the container. I'm out of idea. What is the output you get with the command sp info? Also, if you add some print() to the hook, does it gets printed twice? If so, that means there is definitely something resending the command.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Mon Jan 23, 2017 2:09 am

Yes, it does print twice.

Syntax: Select all

@PreHook(saytext2_filter)
def pre_saytext2_filter(args):
print("\n_hook_")
...


Code: Select all

[SP] Loading plugin 'deadchat'...
[SP] Successfully loaded plugin 'deadchat'.
rcon from "xxxxxxxx": command "sp plugin load deadchat"

_hook_
_hook_*DEAD* frag: hi
sp info

Date          : 2017-01-23 02:07:01.663556
OS            : Windows-10-10.0.14393
Game          : css
SP version    : 539
Server plugins:
   00: Source.Python, (C) 2012-2016, Source.Python Team.
SP plugins:
   00: deadchat
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Sat Jan 28, 2017 1:10 pm

Mentioning again:

I have sourcemod, metamod, tickrate enabler and sourcemod installed, but not activated.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Wed Feb 08, 2017 2:25 am

Another thing I noticed is, that im getting:

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/chatranks/chatRanks.py", line 123, in pre_message_end
    on_user_message_created(message_index, BitBufferRead(buffer), buffer)
  File "../addons/source-python/plugins/chatranks/chatRanks.py", line 145, in on_user_message_created
    name = buffer_read.read_string()

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 30: unexpected end of data


Username: ┼ N‡GH†MΔƦΣ CRΣ3PƦ ⺠: !s
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Sat Feb 11, 2017 5:30 pm

Next to that issue I figured it out why it sends twice (duplicate chat message):

Its cause of SourceTV:

tv_enable 1
tv_autorecord 1
tv_name "Source-TV [Auto-Recording]"
tv_delay 90
tv_password ""
tv_maxclients 10
tv_maxrate 3500
tv_snapshotrate 24
tv_allow_camera_man 0

in autoexec.cfg
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Mon Feb 20, 2017 3:59 pm

Regarding to that Issue:

https://github.com/Source-Python-Dev-Te ... -280918095

How can I do that, with the fixed version for sourcemod? I dont have receipents to use..
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby Ayuto » Mon Feb 20, 2017 6:44 pm

viewtopic.php?p=7944#p7944

I have changed RecipientFilter to BaseRecipientFilter. That will probably fix the issue with SM.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Wed Apr 05, 2017 7:24 pm

Hey,

Sorry for bumping older threads, but Im currently trying to fix my issue with the CS:GO System.

Syntax: Select all

from commands.say import SayCommand
from memory import Convention, DataType, get_object_pointer, make_object
from memory.hooks import PreHook
from messages import SayText2
from engines.server import engine_server
from messages import UserMessage
from _messages import ProtobufMessage


saytext2_index = UserMessage(RecipientFilter(), 'SayText2').message_index

# virtual void SendUserMessage( IRecipientFilter &filter, int message, const google::protobuf::Message &msg ) = 0;
send_user_message = get_object_pointer(engine_server).make_virtual_function(
45,
Convention.THISCALL,
[DataType.POINTER, DataType.POINTER, DataType.INT, DataType.POINTER],
DataType.VOID
)


@PreHook(send_user_message)
def pre_send_user_message(args):
message_index = args[2]
if message_index != saytext2_index:
return

buffer = make_object(ProtobufMessage, args[3])

player_name = buffer.get_repeated_string('params', 0)
message = buffer.get_repeated_string('params', 1)
buffer.set_string('msg_name', "\x02{} \x01says: \x10{}".format(player_name, message))


@SayCommand("!test")
def say_test(command, index, team_only):
print("Issued !test by (index={})".format(index))


Why does the '\x02' at the start of msg_name gets replaced by the team color? Is there a way to change that (In need!)
This is probably cause of {Counter-Terrorist} prefix, but I was modifying that color in CS:S, now its completly trashed cause of that issue.

+ When Im using sourcemod

[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\plugins\test\test.py", line 248, in pre_send_user_message
buffer = make_object(ProtobufMessage, args[3])

RuntimeError: Access violation - no RTTI data!
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby satoon101 » Wed Apr 05, 2017 9:54 pm

I'm not fully sure I understand your issue with \x02. If I remember correctly, in CS:S, that color acts like \x01, but in CS:GO it is a different color (but NOT the team color, as \x03 is the team color).

As for the issue with SourceMod, have you tried this:
https://github.com/Source-Python-Dev-Te ... -167369581
Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Wed Apr 05, 2017 10:44 pm

The problem with the \x02 is, you can replace it with any color, lets say lime green \x06, and the game still replaces it with the team color (\x03) for the first character.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby satoon101 » Wed Apr 05, 2017 10:48 pm

Ah, ok, try adding a leading space just like we have to use in our base SayText(2) implementations:
https://github.com/Source-Python-Dev-Te ... se.py#L257
Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Wed Apr 05, 2017 11:36 pm

My srcds.exe crashes when I put it into my server.cfg with removing the .vdf.

Spams File '..sys', line 1: RuntimeWarning exactly when I join.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Modifying chat with sayfilter but SayCommand doesnt "register"

Postby decompile » Fri Apr 07, 2017 10:41 pm

It didnt change the error

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\test\test.py", line 248, in pre_send_user_message
    buffer = make_object(ProtobufMessage, args[3])

RuntimeError: Access violation - no RTTI data!


I removed the .vdf, let it start up, write "plugin_load "addons/source-python", succesfully loaded and then afterwards my plugin, still getting the error above.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 30 guests