Foreach multi dimension arrays - 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: Foreach multi dimension arrays (
/showthread.php?tid=647270)
Foreach multi dimension arrays -
m4karow - 02.01.2018
Hey there
I've got some problems with theese multi dimension arrays in foreach... I'd like to create a new iterator and select random of them...
First, i tried to declare that but i've got errors... it this method possible or i can use just 2 dimension array?
Код:
static Iterator:Thing[4][5]<100>;
Код:
error 001: expected token: ";", but found "-integer value-"
error 017: undefined symbol "Iter_Single@Thing
but this works fine
Код:
static Iterator:Thing[5]<100>;
Re: Foreach multi dimension arrays -
ThePhenix - 02.01.2018
If you want a two dimensional array, you can do:
PHP код:
new Iterator:Something<1st_dim_upperbound, 2nd_dim_upperbound>;
Example:
PHP код:
new Iterator:Something<30, 10>;
In your case, this would be correct:
PHP код:
static Iterator:Thing<5, 100>;
Re: Foreach multi dimension arrays -
m4karow - 02.01.2018
But where is the '4' array?
I mean this.
Код:
static Iterator:Thing[4][5]<100>;
I would declare that 2 arrays and 100 slots to it.
Re: Foreach multi dimension arrays -
m4karow - 03.01.2018
anyone? :/