Intercepting print message from SV_SendServerCommand

Locked
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Intercepting print message from SV_SendServerCommand

Post 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...
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Intercepting print message from SV_SendServerCommand

Post 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().
Locked