Array inside of an 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Array inside of an Array (
/showthread.php?tid=159430)
Array inside of an Array -
Joe_ - 13.07.2010
Hello
Well I've been struggling with this for 1~ Hours now, and I can't get it right.
This is an example code of what I'm trying to do.
pawn Код:
enum
E_ENUM
{
Options[4]
}
pawn Код:
new
Array[][E_ENUM] =
{
{1, 2, 3, 4}
};
What I want is to insert a integer value into each of the slots of 'Options' array, inside another array.
So for example:
I want 1 to go into 'Options[0]' and 2 to go into 'Options[1]' (Slot is not the same as value due to array slots starting from 0)
Anybody have a idea?
I understand filling the array using a code like:
pawn Код:
Array[0][Options][0] = 1;
But that wouldn't work for what I'm doing.
Just some info:
pawn Код:
:\SA-MPS~1\pawno\script.pwn(45) : warning 227: more initiallers than enum fields
I:\SA-MPS~1\pawno\script.pwn(45) : warning 227: more initiallers than enum fields
Line 43-46:
pawn Код:
new
Array[][E_ENUM] =
{
{1, 2, 3, 4} // 45
}
Re: Array inside of an Array -
Mauzen - 13.07.2010
pawn Код:
Array[][E_ENUM] =
{
{{1, 2, 3, 4}}
}
Try this, I think it should work.
The Enum is like another Array, but with only one field for you, so you need the extra brackets.
Re: Array inside of an Array -
Joe_ - 13.07.2010
I just tested it and it works.
Thankyou, I didn't know you could do that / it worked like that

.