Improve client_print_color by inserting default color code at the start of string
This commit is contained in:
parent
af0042b71d
commit
240c81e626
|
@ -337,6 +337,12 @@ static cell AMX_NATIVE_CALL client_print_color(AMX *amx, cell *params) /* 3 para
|
||||||
g_langMngr.SetDefLang(i);
|
g_langMngr.SetDefLang(i);
|
||||||
msg = format_amxstring(amx, params, 3, len);
|
msg = format_amxstring(amx, params, 3, len);
|
||||||
|
|
||||||
|
if (*msg > 4) // Insert default color code at the start if not present, otherwise message will not be colored.
|
||||||
|
{
|
||||||
|
memmove(msg + 1, msg, ke::Min(len++, 191));
|
||||||
|
*msg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (len > 190) // Server crashes after byte 190. (190 + \n = 191)
|
if (len > 190) // Server crashes after byte 190. (190 + \n = 191)
|
||||||
{
|
{
|
||||||
len = 190;
|
len = 190;
|
||||||
|
@ -369,6 +375,12 @@ static cell AMX_NATIVE_CALL client_print_color(AMX *amx, cell *params) /* 3 para
|
||||||
|
|
||||||
msg = format_amxstring(amx, params, 3, len);
|
msg = format_amxstring(amx, params, 3, len);
|
||||||
|
|
||||||
|
if (*msg > 4) // Insert default color code at the start if not present, otherwise message will not be colored.
|
||||||
|
{
|
||||||
|
memmove(msg + 1, msg, ke::Min(len++, 191));
|
||||||
|
*msg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (len > 190) // Server crashes after byte 190. (190 + \n = 191)
|
if (len > 190) // Server crashes after byte 190. (190 + \n = 191)
|
||||||
{
|
{
|
||||||
len = 190;
|
len = 190;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user