New line after 128 characters. - 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)
+--- Thread: New line after 128 characters. (
/showthread.php?tid=418847)
New line after 128 characters. -
lean1337 - 26.02.2013
Hi, if I write something in chat, like /b on my server, it all get in one line. How do I make it so it continues on a new line?
Here is two screenshots to show what I mean.
This is how I want it. (The interior didnt load :X)
This is how it is right now.
pawn Код:
LEANCMD:(b)
{
if(isnull(params)) return SCM(playerid, COLOR_GREY,"/b [local ooc chat]");
new string[128];
if(AdminDuty[playerid] == 0)
{
format(string, sizeof(string), "(( [%i] %s: %s ))",playerid, GetName(playerid), params);
ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
format(string,sizeof(string),"[%d-%d-%d](( %s: %s ))",GetDay(),GetMonth(),GetYear(),GetName(playerid), params);
Log("/logs/Emotes.txt",string);
return 1;
}
if(AdminDuty[playerid] == 1)
{
format(string, sizeof(string), "(( [%i] {FF9900}%s{C3C3C3}: %s ))",playerid, GetName(playerid), params);
ProxDetector(20.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
format(string,sizeof(string),"[%d-%d-%d][ADMINDUTY] (( %s: %s ))",GetDay(),GetMonth(),GetYear(),GetName(playerid), params);
Log("/logs/Emotes.txt",string);
return 1;
}
return 1;
}
this is my /b command.
Re: New line after 128 characters. -
ikey07 - 26.02.2013
quick sketch.
pawn Код:
inputtext[]
new text[2][128];
if(strlen(inputtext) > 128)
{
strmid(text[0],inputtext,0,127,128); //text[0] will contain text from 0-127
strmid(text[1],inputtext,128,strlen(inputtext),128);//text[1] will contain rest of the string
}
Re: New line after 128 characters. -
Kyle - 26.02.2013
Quote:
Originally Posted by ikey07
quick sketch.
pawn Код:
inputtext[]
new text[2][128];
if(strlen(inputtext) > 128) { strmid(text[0],inputtext,0,127,128); //text[0] will contain text from 0-127 strmid(text[1],inputtext,128,strlen(inputtext),128);//text[1] will contain rest of the string }
|
Don't forget this will cut off half way through a word... In theory you should make a function looking for a space after or on the 128th character.