Page 1 of 1

Intercepting print message from SV_SendServerCommand

Posted: Fri Apr 01, 2011 8:52 am
by Eraser
Line 575 of code\server\sv_client.c in the SV_DropClient method (line number refers to the ioQuake version of this file) is like this:

Code: Select all

SV_SendServerCommand( NULL, "print \"%s" S_COLOR_WHITE " %s\n\"", drop->name, reason );
Is there a way for me to intercept this without changing executable code? I do not want this text to appear in my mod. The problem is that I want to silently drop clients (bots) from the game, but whenever I call trap_DropClient from my mod code it'll display the name of the bot in the console (I pass an empty string as reason). While not terribly shocking, I would find it neater if this message didn't appear.

It's kind of stupid that this sort of thing is part of the game engine rather than the mod to be honest, but oh well...

Re: Intercepting print message from SV_SendServerCommand

Posted: Fri Apr 01, 2011 11:02 am
by ^misantropia^
Yeah, agreed. I think the best you can do is intercept the message in CG_ServerCommand() in cgame/cg_servercmds.c. Pass a unique reason to trap_DropClient() so you can reliably recognize it in CG_ServerCommand().