decompile wrote:Hey,
Tried it out, doesnt work (CSS: Windows + Linux)
Just tested my code and everything you have requested is working except the name change part. You could have been more precise in your reply.
player_changename does get fired when a player changes his name, but it seems like we can't block the message by stopping the event from being broadcasted to the clients. However, hooking UTIL_SayText2Filter is working fine for me:
Syntax: Select all
import memory
from memory import Convention
from memory import DataType
from memory.hooks import PreHook
from core import PLATFORM
if PLATFORM == 'windows':
identifier = b'\x55\x8B\xEC\x68\x2A\x2A\x2A\x2A\xFF\x75\x08\xE8\x2A\x2A\x2A\x2A\x8B\x45\x0C'
else:
identifier = '_Z19UTIL_SayText2FilterR16IRecipientFilterP11CBasePlayerbPKcS4_S4_S4_S4_'
server = memory.find_binary('server')
UTIL_SayText2Filter = server[identifier].make_function(
Convention.CDECL,
[DataType.POINTER, DataType.POINTER, DataType.BOOL, DataType.STRING,
DataType.STRING, DataType.STRING, DataType.STRING, DataType.STRING],
DataType.VOID
)
@PreHook(UTIL_SayText2Filter)
def pre_say_text2_filter(args):
if args[3] == '#Cstrike_Name_Change':
return 0
Edit:
Stopping player_changename from being broadcasted has no effect, because CCSPlayer::ChangeName fires the event
and calls UTIL_SayText2Filter.