Chat Split
#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


Messages In This Thread
Chat Split - by DerickClark - 16.07.2018, 02:07
Re: Chat Split - by TwentyFour - 16.07.2018, 06:14
Re: Chat Split - by DerickClark - 16.07.2018, 06:22
Re: Chat Split - by CodeStyle175 - 16.07.2018, 06:50
Re: Chat Split - by DerickClark - 16.07.2018, 10:45
Re: Chat Split - by TwentyFour - 16.07.2018, 11:59
Re: Chat Split - by DerickClark - 16.07.2018, 17:27
Re: Chat Split - by Hreesang - 17.07.2018, 04:02
Re: Chat Split - by DerickClark - 17.07.2018, 04:21
Re: Chat Split - by denNorske - 17.07.2018, 05:56

Forum Jump:


Users browsing this thread: 3 Guest(s)