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!