SendClientMessageEx
#1

Hello.If someone types a long message it won't show up or it will only show cut off.So what I am trying to do is to create a custom function that will send that long message in two sections using two SendClientMessage's.This code I made is not working very well,sometimes only the second message show up and sometimes it will write the last bit of the first part twice.I hope you can help me.

Код:
SendClientMessageEx(playerid, color, string[])
{
	if(strlen(string) >= 128)
	{
	    SendClientMessage(playerid, color, string);
	    strdel(string, 0, 128);
		SendClientMessage(playerid, color, string);
	}
	else SendClientMessage(playerid, color, string);
	return 1;
}
Reply
#2

Hi there, strdel deletes the part of text, you can use strmid which extracts a part of text from a string.

pawn Код:
SendClientMessageEx(playerid, color, string[])
{
    if(strlen(string) >= 128)
    {
        new partone[129], parttwo[129];
        strmid(partone, string, 0, 128);
        strmid(parttwo, string, 128, strlen(string));
        SendClientMessage(playerid, color, partone);
        SendClientMessage(playerid, color, parttwo);
    }
    else
        SendClientMessage(playerid, color, string);
    return 1;
}
Reply
#3

Thanks +rep'ed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)