How to detect \n when loading from SQL to string?
#1

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.
Reply
#2

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';
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)