String Array - 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: String Array (
/showthread.php?tid=601628)
String Array -
DragonZafiro - 23.02.2016
Hi there!
i'm trying to embed this 2 arrays
Код:
new array1[][][] =
{
{"text array 1", "text array 1.5"},
{"text array 1 - 2", "text array 1.5 - 2"}
};
new array2[][][] =
{
{"text array 2", "text array 2.5"}
};
into only one, but with 2 index
something like:
Код:
array[0][][] =
{
{"text array 1", "text array 1.5"},
{"text array 1 - 2", "text array 1.5 - 2"}
}
array[1][][] =
{
{"text array 2", "text array 2.5"}
};
but i have no idea how to declare it, can someone help me?
Re: String Array -
Nero_3D - 24.02.2016
You would need a 4. dimension which isn't supported by the native compiler
Even if you put them together the compiler would complain that the arrays have different sizes
But you can do a little trick and remove 1 dimension
PHP код:
new _array[][][] =
{
{
"text array 1", "text array 1.5",
"text array 1 - 2", "text array 1.5 - 2"
},
{
"text array 2", "text array 2.5"
}
};
#define array[%0][%1][%2] _array[%0][(2 * (%1)) + (%2)]
You could use a macro to simulate the additional dimension or add the calculation each time
Respuesta: Re: String Array -
DragonZafiro - 24.02.2016
Quote:
Originally Posted by Nero_3D
You would need a 4. dimension which isn't supported by the native compiler
Even if you put them together the compiler would complain that the arrays have different sizes
But you can do a little trick and remove 1 dimension
PHP код:
new _array[][][] =
{
{
"text array 1", "text array 1.5",
"text array 1 - 2", "text array 1.5 - 2"
},
{
"text array 2", "text array 2.5"
}
};
#define array[%0][%1][%2] _array[%0][(2 * (%1)) + (%2)]
You could use a macro to simulate the additional dimension or add the calculation each time
|
Thanks! It works perfectly