Two-dimensional array elements - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Two-dimensional array elements (
/showthread.php?tid=208859)
Two-dimensional array elements -
Stylock - 09.01.2011
Hi, how to set all elements of two-dimensional array to specific values. If I want all sub-array elements to contain 0, 1, 2, 3, 4, and 5, how would I do it without making loops. The example below gives me error:
pawn Код:
new
Vehicle[MAX_VEHICLES][6] =
{
{ 0, 1, ... }, { 0, 1, ... }, ...
};
/*
Elements should contain:
Vehicle[0][0] = 0;
Vehicle[0][1] = 1;
Vehicle[0][2] = 2;
Vehicle[0][3] = 3;
Vehicle[0][4] = 4;
Vehicle[0][5] = 5;
Vehicle[1][0] = 0;
Vehicle[1][1] = 1;
Vehicle[1][2] = 2;
Vehicle[1][3] = 3;
Vehicle[1][4] = 4;
Vehicle[1][5] = 5;
Vehicle[2][0] = 0;
Vehicle[2][1] = 1;
Vehicle[2][2] = 2;
etc...
*/
I also tried few other methods, but they too give me errors.