print and \n - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: print and \n (
/showthread.php?tid=91598)
print and \n -
ledzep - 15.08.2009
I was just wondering why every time I use print, SA:MP automatically assumes I want to make a new line. Shouldn't new lines be determined only by using \n?
Say I want to do something like:
print("loading something");
* one second passes
print(".");
* one second passes
print(".");
* one second passes
print(".");
* task finishes
print("done (x amount loaded, in x amount time)");
so in the end it would look like this:
Код:
loading something...done (x amount loaded, in x amount time)
but if I were to do this is it would look like:
Код:
loading something
.
.
.
done (x amount loaded, in x amount time)
Re: print and \n -
woot - 15.08.2009
Thats normal, you could format strings though and send them using printf once everything is loaded
Re: print and \n -
ledzep - 15.08.2009
The problem with that is it will look like the script is frozen.
Re: print and \n -
fastblast - 15.08.2009
It's possible to do a new print function in a plugin, using the c printf function, which doesn't happend a newline character to the string. Smething like that should work:
Код:
static cell AMX_NATIVE_CALL n_print2(AMX *a, cell *p)
{
const char *s;
amx_StrParam(a, p[1], s);
printf(s);
return true;
}
Problem: this basic code will not write into the server_log.txt, it is fixable but 'illegal'..
Re: print and \n -
ledzep - 17.08.2009
I was thinking/hoping it could be done through a plugin. I myself have no clue where to start with making a plugin, but I found the tutorial.
As for it printing into the log, I don't really care since I would be using it for making a visual representation of loading things as explained in my first post.
I'll try compiling that code you posted. It will be a good learning experience I guess.
Thanks a bunch.