SA-MP Forums Archive
How to define strings? - 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: How to define strings? (/showthread.php?tid=453288)



How to define strings? - Micius - 24.07.2013

How to define strings and use it on "format"?

Getting hude error with this:
#define DEFINED_STRING "Blabla %s"
format(string,sizeof(string),DEFINED_STRING,test);


Re: How to define strings? - MP2 - 24.07.2013

Post the error..


Re: How to define strings? - Areax - 24.07.2013

Use:
pawn Код:
new string[150]
to define it...
And in format:
pawn Код:
format(string, sizeof(string), "Your text here");



Re: How to define strings? - RajatPawar - 24.07.2013

I think you cannot do that. Defined things need to be constants. But you can do this.
pawn Код:
#define STRING "Hello"

new string[50];
format(string, sizeof(string), " "#STRING" world"); // Should print Hello world
print(string);
I may be wrong. But check it out!


Re: How to define strings? - Micius - 24.07.2013

Fixed it, i forgot to add one " and got huge error, still thanks.