String spilting error.
#1

Here's the command, Whenever I go IG and try it, it first gives out "(( (ID)MyName: ... ))" and then on the next line "(( (ID)MyName: .... )) )) " Yes, the second time, there are two )).

pawn Код:
CMD:b(playerid,params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_SYNTAX,"[SYNTAX]: /b [TEXT HERE]");
    new sendername[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    sendername[strfind(sendername,"_")] = ' ';
    if(strlen(params) > 24)
    {
        new part1[24];
        new part2[44];
        strmid(part1,string,0,23,24);
        format(string, sizeof(string), "(( (ID:%d) %s: %s... ))", playerid, GetName(playerid), part1);
        ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
        strmid(part2,string,24,128,44);
        format(string, sizeof(string), "(( (ID:%d) %s: ...%s ))", playerid, GetName(playerid), part2);
        ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    }
    else
    {
        format(string, sizeof(string), "(( (ID:%d) %s: %s ))", playerid, GetName(playerid), params);
        ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    }
    return 1;
}
Reply
#2

Here I'll give an example of what I was trying to do -
P1 - " Hello, So lets test the max string length blablablablablablablablabla[NOW whatever I'll type will split]
P1 - " Blabla string has splitted. "

I hope you get what I mean.
Reply
#3

Well, I edited it a bit and I'm able to see the text I entered but unfortunately, it is not splitting, any idea why ? The string is not empty now.

pawn Код:
CMD:b(playerid,params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_SYNTAX,"[SYNTAX]: /b [TEXT HERE]");
    new sendername[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    sendername[strfind(sendername,"_")] = ' ';
    if(PlayerInfo[playerid][Authenticated] == 1)
    {
   
        format(string, sizeof(string), "(( (ID:%d) %s: %s ))", playerid, GetName(playerid), params);
        ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    }
    else if(strlen(params) > 24)
    {
        new part1[24];
        new part2[44];
        strmid(part1,string,0,23,24);
        format(string, sizeof(string), "(( (ID:%d) %s: %s... ))", playerid, GetName(playerid), part1);
        ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
        strmid(part2,string,24,128,44);
        format(string, sizeof(string), "(( (ID:%d) %s: ...%s ))", playerid, GetName(playerid), part2);
        ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)