Problem with array including string
#1

pawn Код:
new TestArray[2][5] = {
    {"Testing", 244.3659, 305.1818, 999.1484, 1},
    {"Testing2", 322.3637, 303.2862, 999.1484, 5}
};
Код:
(213) : warning 213: tag mismatch
(213) : warning 213: tag mismatch
(213) : warning 213: tag mismatch
(213) : error 018: initialization data exceeds declared size
(216) : error 010: invalid function or declaration
(1808) : error 032: array index out of bounds (variable "TestArray")
Any idea?
Reply
#2

I recommend changing [2] to [] so you can add more data to the array without changing that.

As for your problem, it's because you're using floats which require you to have Float: TestArray instead of just TestArray.
You won't be able to include strings in it because it's a float.
Reply
#3

So I will need to create two arrays, one with the names and one with the coordinates?
Reply
#4

PAWN only allows arrays to hold 1 datatype, you can't mix integers and strings. Use an enumerator if you want to do this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)