SA-MP Forums Archive
Problem with array including string - 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: Problem with array including string (/showthread.php?tid=331065)



Problem with array including string - GiS - 03.04.2012

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?


Re: Problem with array including string - SuperViper - 03.04.2012

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.


AW: Problem with array including string - GiS - 03.04.2012

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


Re: Problem with array including string - Sinner - 03.04.2012

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