SA-MP Forums Archive
DOF2 and NewLine - Help me Please - 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: DOF2 and NewLine - Help me Please (/showthread.php?tid=543452)



DOF2 and NewLine - Help me Please - [XPG]MarlonCS - 26.10.2014

Hello everyone
I have a problem with newline and DOF2.
Exemple:
when I pull the sentence from the file:
"Hello world\nWelcome to my server"
It appears like this:
"Hello world\nWelcome to my server" oO

\n not work.

Code:
Code:
DOF2_GetString(file, "phrase");
In the file:
Code:
phrase = Hello world\nWelcome to my server



Re: DOF2 and NewLine - Help me Please - mkmk - 26.10.2014

For the second one, maybe you're looking for something along the lines of this?

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, -1, "Hello world\nWelcome to my server!");
}
rep if I helped please - reason I'm asking is because I need 15 reps to ad my server.


Re: DOF2 and NewLine - Help me Please - [XPG]MarlonCS - 26.10.2014

Quote:
Originally Posted by mkmk
View Post
For the second one, maybe you're looking for something along the lines of this?

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, -1, "Hello world\nWelcome to my server!");
}
rep if I helped please - reason I'm asking is because I need 15 reps to ad my server.
But friend ...
I want to pull this message from the file, cause my Gamemode have 3 languages.

Exemple: Message to all players about any player entered in the server:

Code:
//OnPlayerConnect
format(string, sizeof(string), DOF2_GetString(LANG1, "WELCOME_ENTERED_ON_SERVER"), pnome(playerid), playerid, hora, minu, seg);
In the file en-us.lang
Code:
WELCOME_ENTERED_ON_SERVER = [SERVER] {00FF00}%s{C0C0C0} [{00FF00}%d{C0C0C0}] entered the server {00FF00}[%02d:%02d:%02d]
In the file pt-br.lang
Code:
WELCOME_ENTERED_ON_SERVER = [SERVER] {00FF00}%s{C0C0C0} [{00FF00}%d{C0C0C0}] entrou no servidor {00FF00}[%02d:%02d:%02d]



Re: DOF2 and NewLine - Help me Please - [XPG]MarlonCS - 26.10.2014

Quote:
Originally Posted by ******
View Post
"\n" is actually converted by the PAWN compiler in to a true new line (ASCII 10 (or 0x10, I forget which)). Thus typing that in game or in files will get you exactly what you typed - a backslash then an "n", because that text hasn't gone through the compiler. That sequence isn't magical, if you want a newline you will need to scan for and convert them yourselves.
How?
Can you help me?