How to detect \n when loading from SQL to string? - 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: How to detect \n when loading from SQL to string? (
/showthread.php?tid=616184)
How to detect \n when loading from SQL to string? -
czop1223 - 01.09.2016
Hello, I am loading the 3DText from table and i have linebreaks (\n) in it. But in the game, they just show up as a normal \n and dont linebreak. Do you have an idea on how to actually make them break the line?
The 3DText is just loaded to a new text[128] variable from mysql cache.
Re: How to detect \n when loading from SQL to string? -
Jefff - 01.09.2016
In save use some special character for \n for example #
pawn Код:
SaveMyString(str[])
{
for(new i = strlen(str) - 1; i > -1; i--)
if(str[i] == '\n')
str[i] = '#';
}
next in loading
pawn Код:
ReplaceChar(str[])
{
for(new i = strlen(str) - 1; i > -1; i--)
if(str[i] == '#')
str[i] = '\n';
}