String too big = no text - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: String too big = no text (
/showthread.php?tid=152472)
String too big = no text -
MafiaGuy™ - 04.06.2010
I seen on some servers a fix to this:
e.g. /ad Selling my Bravura for only 56k, Brand new, null dents...
... SMS me with your offers. Blablablabla
I aint sure how to split this ad in two pieces if it is too long.
I guess using strlen and maybe split ?
Re: String too big = no text -
MadeMan - 04.06.2010
You can use this function.
pawn Код:
SendSplittedMessage(playerid, color, const msg[], maxlen)
{
new firstpos, lastpos;
new part[128];
new count = 1;
new length = strlen(msg);
for(new p=0; p < length; p++)
{
if(msg[p] == ' ')
{
lastpos = p;
}
if(p == length-1)
{
lastpos = length;
}
if(p >= count*maxlen || p == length-1)
{
if(lastpos == firstpos) { lastpos = count*maxlen; }
strmid(part, msg, firstpos, lastpos, 128);
firstpos = lastpos;
count++;
SendClientMessage(playerid, color, part);
}
}
}