SA-MP Forums Archive
\n not working - 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: \n not working (/showthread.php?tid=418081)



\n not working - Jstylezzz - 23.02.2013

Hi all,

I have kind of a weird thing here..
When I use \n in a format function, like this one here:
pawn Code:
format(string,128,"Welcome %s , thanks for logging in!\nYour last login was on: %d-%d-%d , from IP adress: %s",...);
The \n is ignored, and the text is on one line.
This works in my login dialog, but not in the sent messages.

Anything I'm doing wrong here?


Re: \n not working - Scenario - 23.02.2013

You cannot use \n with SendClientMessage. AFAIK it (\n) only works with dialog boxes.


Re: \n not working - Jstylezzz - 23.02.2013

Really?
Hmm, I will send it in 2 messages then, thanks


Re: \n not working - Aarab - 23.02.2013

Code:
format(string,128,"Welcome %s , thanks for logging in!\nYour last login was on: %d-%d-%d , from IP adress: %s",...);

new string[128];
SendClientMessage(playerid, COLOR_CODE, "%d-%d-%d"); // extra line 1
I'm new in scripting, so I dont know or i'm right or not ^^


Re: \n not working - Scenario - 23.02.2013

Quote:
Originally Posted by Aarab
View Post
Code:
format(string,128,"Welcome %s , thanks for logging in!\nYour last login was on: %d-%d-%d , from IP adress: %s",...);

new string[128];
SendClientMessage(playerid, COLOR_CODE, "%d-%d-%d"); // extra line 1
I'm new in scripting, so I dont know or i'm right or not ^^
You have to format the %d-%d-%d, you can't just put it into the code and expect it to work. That's why we use the format() function. It allows us to replace %d, %s, %i, %f, etc with values of variables we specify.