SA-MP Forums Archive
sizeof in multi-dimensional array - error? - 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: sizeof in multi-dimensional array - error? (/showthread.php?tid=215060)



sizeof in multi-dimensional array - error? - Deji - 22.01.2011

I have a multi-dimensional array looking like this..
Код:
new PedCategories[][][] = {
// male
{
    // asian
    {49,57,58...}
    // black
    {...}
    // hispanic
    {...}
    // white
    {...}
}
// female
{
    // asian
    {...}
    // black
    {...}
    // hispanic
    {...}
    // white
    {...}
}
I'm trying to access the skin IDs by first counting how many skins are in any array...
Код:
i = sizeof(PedCategories[male][black]);
Instead of compiling code to count how many black males there are, Pawno decided it would be easier to throw this error:
Код:
***.pwn(436) : error 001: expected token: "]", but found "-identifier-"
***.pwn(436) : warning 215: expression has no effect
***.pwn(436) : error 001: expected token: ";", but found "]"
***.pwn(436) : error 029: invalid expression, assumed zero
***.pwn(436) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Any reason for this?


Re: sizeof in multi-dimensional array - error? - Steven Paul - 22.01.2011

post only your 436 line


Re: sizeof in multi-dimensional array - error? - Deji - 22.01.2011

I already did.. The one right above the error list.


Re: sizeof in multi-dimensional array - error? - Stylock - 22.01.2011

pawn Код:
i = sizeof(PedCategories[][]);



Re: sizeof in multi-dimensional array - error? - Deji - 22.01.2011

Ahh, I get it. The array size adopts the largest dimension containing the skins. I was thinking as if they were arrays inside arrays, which could have variable sizes..

Turns out I'd need a string with 3200 cells to do what I'm planning.. hmm...

Thanks.