16.07.2018, 02:07
(
Последний раз редактировалось DerickClark; 28.07.2018 в 23:44.
)
errr
SendExtendedMessageToAll(color, const string[]);
stock SendExtendedMessageToAll(color, const string[])
{
if(strlen(string) > 120)
{
new msg[120];
format(msg, sizeof(msg), "%s", string); // 0 to 120
SendClientMessageToAll(color, msg);
format(msg, sizeof(msg), "{FFFFFF}...%s", string[120]); // 120 to the end
SendClientMessageToAll(color, msg);
return 1;
}
else
{
SendClientMessageToAll(color, string);
return 1;
}
}
|
Yes you can.
Код:
SendExtendedMessageToAll(color, const string[]); Код:
stock SendExtendedMessageToAll(color, const string[])
{
if(strlen(string) > 120)
{
new msg[120];
format(msg, sizeof(msg), "%s", string); // 0 to 120
SendClientMessageToAll(color, msg);
format(msg, sizeof(msg), "{FFFFFF}...%s", string[120]); // 120 to the end
SendClientMessageToAll(color, msg);
return 1;
}
else
{
SendClientMessageToAll(color, string);
return 1;
}
}
|
stock SendExtendedMessageToAll(color, msg[])
{
new len=strlen(msg);
if(len > 120){
new s1[120],s2[120],breakpoint=90;
strmid(s1,msg,0,breakpoint);
strmid(s2,msg,breakpoint,len);
SendClientMessageToAll(color, s1);
SendClientMessageToAll(color, s2);
}else{
SendClientMessageToAll(color, msg);
}
return 1;
}
|
What you mean? Do you want to split the string when it's over the limit?
Like example: Hreesang says: Bro what's up bro what's up, hahaha, you're so funny, hahaha, what's up bro? To: Hreesang says: Bro what's up bro what's up, hahaha, you're... Hreesang says: ... so funny, hahaha, what's up bro? |
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;
}