OnPlayerText Problem
#1

Hello everyone today i having an issue in my script at OnPlayerText i am using chat colors for my server but if any player choose a color from chat color dialog its sending message like this



1 line with color message and after that sending in white color i am getting confused check my code and try to help me out about the problem.

Code of OnPlayerText
PHP код:
for (new 0PLAYERSi++)
{
                if (
IsPlayerConnected(i))
                {
                    if(
dini_Isset(AddDirFile(dir_userfilesplayername), "CColor"))
                    {
                        if (
PlayerIgnored[i][playerid] == 0)
                        {
                                    
format(string,sizeof(string), "%s[%d]: {%s}%s"stringplayeriddini_Get(AddDirFile(dir_userfilesplayername), "CColor"), text);
                                    
SendPlayerMessageToPlayer(iplayeridstring);
                        }
                    }
                    else
                    {
                        if (
PlayerIgnored[i][playerid] == 0)
                        {
             
                                   
format(string,sizeof(string), "[%d]: %s"playeridtext);
                                   
SendPlayerMessageToPlayer(iplayeridstring);
                        }
                    }
                }

Reply
#2

PHP код:
// Define when to split the text into another line!
#define EX_SPLITLENGTH 118

stock SendSplitMessage(playeridcolor, final[])
{
    new 
buffer[EX_SPLITLENGTH+5];
    new 
len strlen(final);
    if(
len>EX_SPLITLENGTH)
    {
        new 
times = (len/EX_SPLITLENGTH);
        for(new 
0times+1i++)
        {
            
strdel(buffer0EX_SPLITLENGTH+5);
            if(
len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
            {
                
strmid(buffer, final, EX_SPLITLENGTH*iEX_SPLITLENGTH*(i+1));
                
format(buffersizeof(buffer), "%s ..."buffer);
            }
            else
            {
                
strmid(buffer, final, EX_SPLITLENGTH*ilen);
            }
            
SendClientMessage(playeridcolorbuffer);
        }
    }
    else
    {
        
SendClientMessage(playeridcolor, final);
    }

Usage

PHP код:
SendSplitMessage(playeridcolormsg); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)