SA-MP Forums Archive
Quick question about '\1' - 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: Quick question about '\1' (/showthread.php?tid=522656)



Quick question about '\1' - Riwerry - 28.06.2014

Hello guys, what does mean this when I use it? \1


Re: Quick question about '\1' - Laurey - 28.06.2014

Nothing


Re: Quick question about '\1' - [WSF]ThA_Devil - 28.06.2014

You shouldn't use that at all, but there is use of \0.
That means that string is null ( empty )
Passing such string trough callremotefunction WILL crash server.


Re: Quick question about '\1' - Riwerry - 28.06.2014

Yeah, that's true I'm using it for empty string in CallLocalFunction, but \0 not work, I've tried this:
pawn Код:
CallLocalFunction(cmdname, "is", playerid, "\0");
//and this too
CallLocalFunction(cmdname, "is", playerid, '\0');
Both crashes server


Re: Quick question about '\1' - [WSF]ThA_Devil - 28.06.2014

Quote:
Originally Posted by Riwerry
Посмотреть сообщение
Yeah, that's true I'm using it for empty string in CallLocalFunction, but \0 not work, I've tried this:
pawn Код:
CallLocalFunction(cmdname, "is", playerid, "\0");
//and this too
CallLocalFunction(cmdname, "is", playerid, '\0');
Both crashes server
"\0" is END OF STRING
if 1st character is end of string, obviously it will have troubles.

Just do not use it. You do not need to pass empty string.
Unless you want to crash the server... Which I once did


Re: Quick question about '\1' - Riwerry - 28.06.2014

Okay, now I have second little off topic question.
Is possible to parse preprocessor define string for example to include?
In GM:
pawn Код:
#include mystring "foo"
In INC for example:
pawn Код:
print(mystring);
I've tried it but I'm getting error in include, that it's undefined.


Re: Quick question about '\1' - Konstantinos - 28.06.2014

ZCMD uses "\1" as argument of "cmdtext" when it's supposed to be NULL. Although, due to the bug that crashes the server if the string is empty, using "\1" is like using nothing and it prevents the crash.


Re: Quick question about '\1' - iZN - 28.06.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
ZCMD uses "\1" as argument of "cmdtext" when it's supposed to be NULL. Although, due to the bug that crashes the server if the string is empty, using "\1" is like using nothing and it prevents the crash.
Yes, you're right. "\1" is one byte which will prevent crashing issue.