- Komanda x Funkcija:
/*
2019 - ChatBreaker Include v1.0. written by Logan
08/2020 - v1.1. - Added support for breaking/passing embedded colors in next chat line/row
*/
stock SendSplitMessage(playerid, color, const final[])
{
new len = strlen(final);
if(len >= 100)
{
new buffer,
colorstring = EOS, colorstart = 0, colorend = 0,
buffer2, spacepos = 0, bool:broken = false;
for(new j = 60; j < len; j++)
{
if(final == '{')
colorstart = j;
if(final == '}')
colorend = j + 1;
if(final == ' ')
spacepos = j;
if(j >= 90 && spacepos >= 60 && (colorstart == 0 || (colorstart != 0 && colorend > colorstart)))
{
broken = true;
if(colorstart != 0 && colorend != 0)
strmid(colorstring, final, colorstart, colorend, sizeof(colorstring));
strmid(buffer, final, 0, spacepos);
format(buffer, sizeof(buffer), "%s...", buffer);
SendClientMessage(playerid, color, buffer);
strmid(buffer2, final, spacepos+1, len);
format(buffer2, sizeof(buffer2), "%s...%s", colorstring, buffer2);
SendClientMessage(playerid, color, buffer2);
return 1;
}
}
if(!broken)
SendClientMessage(playerid, color, final);
}
else return SendClientMessage(playerid, color, final);
return 1;
}
stock SendSplitMessageToAll(color, const final[])
{
new len = strlen(final);
if(len >= 100)
{
new buffer,
colorstring = EOS, colorstart = 0, colorend = 0,
buffer2, spacepos = 0, bool:broken=false;
for(new j = 60; j < len; j++)
{
if(final == ' ')
spacepos = j;
if(final == '{')
colorstart = j;
if(final == '}')
colorend = j + 1;
if(j >= 90 && spacepos >= 60 && (colorstart == 0 || (colorstart != 0 && colorend > colorstart)))
{
broken = true;
if(colorstart != 0 && colorend != 0)
strmid(colorstring, final, colorstart, colorend, sizeof(colorstring));
strmid(buffer, final, 0, spacepos);
format(buffer, sizeof(buffer), "%s...", buffer);
SendClientMessageToAll(color, buffer);
strmid(buffer2, final, spacepos+1, len);
format(buffer2, sizeof(buffer2), "%s...%s", colorstring, buffer2);
SendClientMessageToAll(color, buffer2);
return 1;
}
}
if(!broken)
SendClientMessageToAll(color, final);
}
else return SendClientMessageToAll(color, final);
return 1;
}
stock AC_SendClientMessageToAll(color, const message[])
{
SendSplitMessageToAll(color, message);
return 1;
}
#if defined _ALS_SendClientMessageToAll
#undef SendClientMessageToAll
#else
#define _ALS_SendClientMessageToAll
#endif
#define SendClientMessageToAll AC_SendClientMessageToAll
stock AC_SendClientMessage(playerid, color, const message[])
{
SendSplitMessage(playerid, color, message);
return 1;
}
#if defined _ALS_SendClientMessage
#undef SendClientMessage
#else
#define _ALS_SendClientMessage
#endif
#define SendClientMessage AC_SendClientMessage
- Opis: ChatBreaker v1.1 lomi SCM(ToAll) stringove duže od 100 znakova u 2 reda, nikada usred riječi, nego traži space da bi slomi od 60tog do 90tog znaka. Ukoliko ih ne nađe, ne razlama se string(što se gotovo nikad ne dešava, pošto su tako duge riječi VRLO rijetke). Prenosi i embedded({ FFFFFF }) boje u sljedeći red ukoliko postoje unutar stringa.