Issue with splitting a long string into two strings.
#1

Hello, so it seems to only send the proper string to ID 0. See screenshots below for the differences.


What ID 0 sees:



What ID 1 sees:



Does anyone know what the issue is? Please help.

Here is the code:

PHP Code:
stock SendSplitMessage(playeridcolorstring[])
{
    if(
strlen(string) > 127)
    {
        new
            
string2[128],
            
splitpos;
        for(new 
1280c--)
        {
            if(
string[c] == ' ' || string[c] ==  ',' || string[c] ==  '.')
            {
                
splitpos c;
                break;
            }
        }
        
strcat(string2string[splitpos]);
        
string[splitpos] = EOS;
        
        
SendClientMessage(playeridcolorstring);
        
format(string2sizeof(string2), "-..%s"string2);
        
SendClientMessage(playeridcolorstring2);
    }
    else 
SendClientMessage(playeridcolorstring);
    
    return 
1;
}
stock ProxDetector(Float:radiplayeridstring[],color)
{
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    foreach(new 
i:Player)
    {
        if(
IsPlayerInRangeOfPoint(i,radi,x,y,z) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
        {
            
SendSplitMessage(i,color,string);
        }
    }
}
forward ProxDetectorColor(Float:radiplayeridstring[],col1,col2,col3,col4,col5);
public 
ProxDetectorColor(Float:radiplayeridstring[],col1,col2,col3,col4,col5)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        foreach(new 
i:Player)
        {
            if(
IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                
GetPlayerPos(iposxposyposz);
                
tempposx = (oldposx -posx);
                
tempposy = (oldposy -posy);
                
tempposz = (oldposz -posz);
                if (((
tempposx radi/16) && (tempposx > -radi/16)) && ((tempposy radi/16) && (tempposy > -radi/16)) && ((tempposz radi/16) && (tempposz > -radi/16)))
                {
                    
SendSplitMessage(icol1string);
                }
                else if (((
tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8)))
                {
                    
SendSplitMessage(icol2string);
                }
                else if (((
tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4)))
                {
                    
SendSplitMessage(icol3string);
                }
                else if (((
tempposx radi/2) && (tempposx > -radi/2)) && ((tempposy radi/2) && (tempposy > -radi/2)) && ((tempposz radi/2) && (tempposz > -radi/2)))
                {
                    
SendSplitMessage(icol4string);
                }
                else if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
                {
                    
SendSplitMessage(icol5string);
                }
            }
        }
    }
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    if(!
gamemodeLoaded)
    {
        
SCM(playeridCOLOR_ERROR"Please wait until the gamemode finishes loading.");
        
SCM(playeridCOLOR_SERVER"Your request was not processed.");
        return 
0;
    }
    if(!
LoggedIn[playerid] || Spawned[playerid] == 0)
    {
        
SCM(playeridCOLOR_ERROR"You are not logged in or have not spawned yet.");
        
SCM(playeridCOLOR_SERVER"You must login and spawn first before your request can be processed.");
        return 
0;
    }
    new 
str[500];
    if(
AdminDuty[playerid] == 1)
    {
        
format(strsizeof(str), "(( %s %s(%i): %s ))",ReturnAdminLevel(playerid), ReturnICName(playerid), playeridtext);
        
ProxDetector(20.0playeridstrCOLOR_ORANGE);
    }
    else if(
DevDuty[playerid] == 1)
    {
        
format(strsizeof(str), "(( %s %s(%i): %s ))",ReturnDevLevel(playerid), ReturnICName(playerid), playeridtext);
        
ProxDetector(20.0playeridstrCOLOR_DEV);
    }
    else
    {
        
format(strsizeof(str), "%s says: %s"ReturnICName(playerid), text);
        
ProxDetectorColor(20.0playeridstrCOLOR_GRAD1COLOR_GRAD2COLOR_GRAD3COLOR_GRAD4COLOR_GRAD5);
        
SetPlayerChatBubble(playeridstrCOLOR_CHAT305000);
    }
    new 
query[300];
    
mysql_format(g_SQLquerysizeof(query), "INSERT INTO logs_chat(acc_dbid, acc_name, playerid, time, text) VALUES('%i', '%e', '%i', UTC_TIMESTAMP(), '%e')"PlayerInfo[playerid][pDBID], ReturnName(playerid), playeridtext);
    
mysql_tquery(g_SQLquery);
    return 
0;
}
CMD:brackets(playeridparams[])
    return 
cmd_b(playeridparams);
CMD:b(playeridparams[])
{
    new 
str[500];
    if(
sscanf(params,"s[128]",str))
        return 
SCM(playeridCOLOR_INFO"/b(rackets) [message]");
    
format(strsizeof(str), "(( %s(%i): %s ))"ReturnICName(playerid), playeridstr);
    
ProxDetector(20playeridstrCOLOR_CHAT);
    return 
1;
}
CMD:whisper(playeridparams[])
    return 
cmd_w(playeridparams);
CMD:w(playeridparams[])
{
    new 
str[300],str2[300], str3[80], targetidFloat:xFloat:yFloat:zworldworld2;
    if(
sscanf(params,"us[128]",targetidstr2))
        return 
SCM(playeridCOLOR_INFO"/whisper [name/id] [message]");
    if(!
IsPlayerConnected(targetid))
        return 
SCM(playeridCOLOR_ERROR"That account is not connected.");
    if(
FirstSpawn[targetid])
        return 
SCM(playeridCOLOR_ERROR"That player has not logged in or spawned yet.");
    if(
targetid == playerid)
        return 
SCM(playeridCOLOR_ERROR"You can not use this command on yourself.");
    
GetPlayerPos(targetidFloat:xFloat:yFloat:z);
    
world GetPlayerVirtualWorld(playerid);
    
world2 GetPlayerVirtualWorld(targetid);
    if (!
IsPlayerInRangeOfPoint(playerid4.0xyz)) 
        return 
SCM(playeridCOLOR_ERROR"That player is not nearby.");
    if(
world == world2)
    {
        
format(strsizeof(str), "Whisper to %s: %s"ReturnICName(targetid), str2);
        
SendSplitMessage(playeridCOLOR_YELLOWstr);
        
format(strsizeof(str), "%s whispers: %s"ReturnICName(playerid), str2);
        
SendSplitMessage(targetidCOLOR_YELLOWstr);
        
format(str3sizeof(str3), "%s mutters something to %s"ReturnICName(playerid), ReturnICName(targetid));
        
SetPlayerChatBubble(playeridstr3COLOR_RP20.03000);
    }
    else return 
SCM(playeridCOLOR_ERROR"That player is not nearby.");
    return 
1;

Reply
#2

Issue solved, if anyone else has this, I recommend using zmessage

https://github.com/Open-GTO/zmessage
Reply
#3

You will need targetid not just one id, playerid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)