// Client console truncates after byte 127. // If format string is used, limit includes double new lines (125 + \n\n), otherwise one new line (126 + \n). const auto bytesLimit = canUseFormatString ? 125 : 126;
if (g_bmod_cstrike && params[2] == HUD_PRINTCENTER) // Likely a temporary fix. { for (int j = 0; j < len; ++j) { if (msg[j] == '\n') { msg[j] = '\r'; } } } else if (((params[2] == HUD_PRINTNOTIFY) || (params[2] == HUD_PRINTCONSOLE)) && (len > bytesLimit)) { len = bytesLimit; if ((msg[len - 1] & 1 << 7)) { len -= UTIL_CheckValidChar(msg + len - 1); // Don't truncate a multi-byte character } } msg[len++] = '\n';
if (canUseFormatString) { if (!g_bmod_cstrike || params[2] == HUD_PRINTNOTIFY || params[2] == HUD_PRINTCONSOLE) { msg[len++] = '\n'; // Double newline is required when pre-formatted string in TextMsg is passed as argument. } }
msg[len] = 0;
UTIL_ClientPrint(pPlayer->pEdict, params[2], msg); } } } else // A specific player { int index = params[1];
if (index < 1 || index > gpGlobals->maxClients) { LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); return 0; }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(index);
msg = format_amxstring(amx, params, 3, len);
// Client console truncates after byte 127. // If format string is used, limit includes double new lines (125 + \n\n), otherwise one new line (126 + \n). const auto bytesLimit = canUseFormatString ? 125 : 126;
if (g_bmod_cstrike && params[2] == HUD_PRINTCENTER) // Likely a temporary fix. { for (int j = 0; j < len; ++j) { if (msg[j] == '\n') { msg[j] = '\r'; } } } else if (((params[2] == HUD_PRINTNOTIFY) || (params[2] == HUD_PRINTCONSOLE)) && (len > bytesLimit)) // Client console truncates after byte 127. (125 + \n\n = 127) { len = bytesLimit; if ((msg[len - 1] & 1 << 7)) { len -= UTIL_CheckValidChar(msg + len - 1); // Don't truncate a multi-byte character } } msg[len++] = '\n';
if (canUseFormatString) { if (!g_bmod_cstrike || params[2] == HUD_PRINTNOTIFY || params[2] == HUD_PRINTCONSOLE) { msg[len++] = '\n'; // Double newline is required when pre-formatted string in TextMsg is passed as argument. } }