Storing text data in a variable with an array
#1

How to store text data in a variable with an array?
I tried to make this but didn't work!
pawn Code:
new text[15];
text[0] = "text1";
text[1] = "text2";
Reply
#2

Code:
new text[2][15];

text[0] = "text1";
text[1] = "text2";
Reply
#3

I already tried this also and the compiler became with:
Code:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:          17132 bytes
Code size:          1228336 bytes
Data size:         28176116 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:29437968 bytes
Reply
#4

Quote:
Originally Posted by Juvanii
View Post
How to store text data in a variable with an array?
I tried to make this but didn't work!
pawn Code:
new text[15];
text[0] = "text1";
text[1] = "text2";
You can only store 1 bit of information in each cell of the array.
When using format, or text[15] = "string" it's practically just:
pawn Code:
text[0] = "s";
text[1] = "t";
text[2] = "r";
text[3] = "i";
text[4] = "n";
text[5] = "g";
text[6] = "";
The last character will be taken up by "null".
So you have to use ball's method, which works fine for me.
I don't think there's a problem in using it, even though it gives that result, unless your server crashes or something ofcourse.
Reply
#5

Quote:
Originally Posted by CalvinC
View Post
You can only store 1 bit of information in each cell of the array.
I know that, i created this thread to see if there is a method to store text data or not!
consider i have 30 text data wanna use it in formatting a msg under one function, it's impossible to make 30 local variables such as:
pawn Code:
new variable1[50];
new variable2[50];
new variable3[50];
new variable4[50];
new variable5[50];
...
...
...
EDIT: FIXED
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)