// 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. } }
not 100% sure on this, but i think messages sent with engclient_print can be hooked/edited/blocked by other plugins but with client_print messages you can't do that
If it is analogous to client_cmd() and engclient_cmd() then client_print() is for sending a message to one or all players from the server and engclient_print() is for forcing a player to send a message without sending the message to the player's client console first (i.e. instead of using client_cmd(id, "say hello world")).
Quote:
Originally Posted by jimaway
not 100% sure on this, but i think messages sent with engclient_print can be hooked/edited/blocked by other plugins but with client_print messages you can't do that
If this analogy is true, it wouldn't be hookable by any plugins. For engclient_cmd(), a new command, amxclient_cmd(), had to be created so that it could be hooked by a plugin.