How to define strings?
#1

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);
Reply
#2

Post the error..
Reply
#3

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

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!
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)