Fixed LogMessageFormatted ignoring unspecified clients (-1) when ignore console is enabled. Simplified logic.

When ignoring console the match must be explicit (client 0), not just any non-valid player. Unspecified clients (-1) are used on core events, but they were wrongfully ignored. Clients are only specified on player events or console events.
Simplified logig: Instead of checking what something isn't, check what it's required to be. Inverted logic may be confusing.
This commit is contained in:
richard 2009-04-27 20:08:59 +02:00
parent c9724a09c7
commit 55876fe2ff

View File

@ -100,11 +100,8 @@ LogMessageFormatted(client, const String:module[], const String:block[], const S
decl String:logtext[LOG_MAX_LENGTH_FILE]; decl String:logtext[LOG_MAX_LENGTH_FILE];
// Set to true if log to console, false if client. // If client is invalid (console), and console log events are ignored, then stop.
new bool:console = !ZRIsClientValid(client); if (client == 0 && LogCheckFlag(LOG_IGNORE_CONSOLE))
// If client is invalid (console), and console is ignored, then stop.
if (console && LogCheckFlag(LOG_IGNORE_CONSOLE))
{ {
return; return;
} }
@ -141,8 +138,8 @@ LogMessageFormatted(client, const String:module[], const String:block[], const S
LogToAdmins(logtext); LogToAdmins(logtext);
} }
// If client isn't console, and we log to client's then continue. // If client is a valid client (but not console), and we log to client's then continue.
if (!console && LogCheckFlag(LOG_TO_CLIENT)) if (ZRIsClientValid(client) && LogCheckFlag(LOG_TO_CLIENT))
{ {
// Set client as translation target. // Set client as translation target.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);