02.05.2015, 15:58
I want to create a way so if I sent a message bigger then 125 chars, it gets break to multiple messages so it doesn't get removed by client.
Here is what I did but it doesn't work as intended:
Help greatly appreciated.
Here is what I did but it doesn't work as intended:
PHP код:
#define MAX_SEND_STR 125
public SendClientMessageEx(playerid, color, msg[])
{
if(strlen(msg) > MAX_SEND_STR)
{
new pendingtxt[300]; format(pendingtxt, sizeof(pendingtxt), "%s", msg);
for(;;)
{
if(strlen(pendingtxt) > MAX_SEND_STR)
{
new txtsent[101];
strmid(txtsent, pendingtxt, 0, MAX_SEND_STR); strdel(pendingtxt, 0, MAX_SEND_STR);
SendClientMessage(playerid, color, txtsent);
} else {
return SendClientMessage(playerid, color, pendingtxt); //this should break the loop.
}
}
} else {
return SendClientMessage(playerid, color, msg);
}
return 0;
}