Chat Split
#1

errr
Reply
#2

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;
	}
}
Reply
#3

Quote:
Originally Posted by TwentyFour
Посмотреть сообщение
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;
	}
}
Does not worked
Reply
#4

PHP код:
stock SendExtendedMessageToAll(colormsg[])
{
    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(colors1);
        
SendClientMessageToAll(colors2);
    }else{
        
SendClientMessageToAll(colormsg);
    }
    return 
1;

Reply
#5

Still won't work
Reply
#6

show your code
Reply
#7

errrr
Reply
#8

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?
Reply
#9

Quote:
Originally Posted by Hreesang
Посмотреть сообщение
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?
Nope but close.
as this

Derick: Hello the weather look
strange today
Reply
#10

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.

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 
ii++; i<sizeof(pS))
                {
                    
//search for any characters nearby
                    
CharPos strfind(txt1pS[i], truepos=95) != -1
                        break; 
                }
                if(
CharPos != -1)
                    
//We've found a char that is defined in the pS array...
                    
strmid(txt11txt1CharPos+1strlen(txt1));
                else if(
CharPos == -1)
                {
                    
strmid(txt11txt1CharPosstrlen(txt1)); //no defined letters found
                    
strins(txt1"-"strlen(txt1)); //insert a letter to inform that word continues below
                
}
            }
            
//send the message
            
SendClientMessage(icolortxt1);
            
            if(
strlen(txt11))
                
SendClientMessage(icolortxt11);
        }    
        else 
//do the same here with the other variable
        
{
            
SendClientMessage(icolortxt);
            
            if(
strlen(txt0)) //only send when there are contents in the var.
                
SendClientMessage(icolortxt0);
        }
    }
    return 
1;

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)