17.07.2018, 05:56
I did not have the chance to test this for you. Reason being I am at work, but still here is a way you could do it.
Look at my method for the txt1 variable, it might be possible to make it better, but it should get the job done.
Make sure to do the same for the remaining txt and txt0; as i defined.
Also, I think there was a limit of characters the client could send through the chatline, so at some point the text won't be longer than 144. https://sampforum.blast.hk/showthread.php?tid=404352
Look at my method for the txt1 variable, it might be possible to make it better, but it should get the job done.
PHP код:
SendChatMessage(color,const txt[],const txt1[])
{
for(new i=GetPlayerPoolSize()+1; --i!=-1;)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i))
continue;
new txt11[60], txt0[60]; pS[3] = {'!', ' ', ':'}, CharPos = -1;
if(Chat[i])
{
if(strlen(txt1) > 100)
{
for(new i; i++; i<sizeof(pS))
{
//search for any characters nearby
CharPos = strfind(txt1, pS[i], true, pos=95) != -1)
break;
}
if(CharPos != -1)
//We've found a char that is defined in the pS array...
strmid(txt11, txt1, CharPos+1, strlen(txt1));
else if(CharPos == -1)
{
strmid(txt11, txt1, CharPos, strlen(txt1)); //no defined letters found
strins(txt1, "-", strlen(txt1)); //insert a letter to inform that word continues below
}
}
//send the message
SendClientMessage(i, color, txt1);
if(strlen(txt11))
SendClientMessage(i, color, txt11);
}
else //do the same here with the other variable
{
SendClientMessage(i, color, txt);
if(strlen(txt0)) //only send when there are contents in the var.
SendClientMessage(i, color, txt0);
}
}
return 1;
}
Also, I think there was a limit of characters the client could send through the chatline, so at some point the text won't be longer than 144. https://sampforum.blast.hk/showthread.php?tid=404352