I wrote my own facilities
Code:
int printf (const char *fmt, ...)
{
// this function prints a message on the screen. If we are running a dedicated server, the
// text will be printed on the server console, else if we are running a listen server, it
// will be printed in game on the listen server client's HUD chat area. Since it's basically
// a redefinition of the standard C libraries printf() function, it has to be the same type,
// hence the integer return value.
va_list argptr;
static char string[1024];
// concatenate all the arguments in one string
va_start (argptr, fmt);
vsprintf (string, fmt, argptr);
va_end (argptr);
// are we running a listen server ?
if (!server.is_dedicated && IsValidPlayer (pListenserverEntity))
{
MESSAGE_BEGIN (MSG_ONE, GetUserMsgId ("SayText"), NULL, pListenserverEntity); // then print to HUD
WRITE_BYTE (ENTINDEX (pListenserverEntity));
WRITE_STRING (string);
MESSAGE_END ();
}
else
pfnServerPrint (string); // else print to console
// if developer mode is on...
if (server.developer_level > 0)
LogToFile ("(server HUD): %s", string); // also log this message to the logfile
return (0); // printf() HAS to return a value
}
int ServerConsole_printf (const char *fmt, ...)
{
// this function asks the engine to print a message on the server console
va_list argptr;
static char string[1024];
// concatenate all the arguments in one string
va_start (argptr, fmt);
vsprintf (string, fmt, argptr);
va_end (argptr);
(*g_engfuncs.pfnServerPrint) (string); // print to console
// if developer mode is on...
if (server.developer_level > 0)
if (string[0] == '.')
LogToFile (string); // also log this message to the logfile (not prefixing dots)
else
LogToFile ("(server console): %s", string); // also log this message to the logfile
return (0); // printf() HAS to return a value
}