SA-MP Forums Archive
Getting data from 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)
+--- Thread: Getting data from an array (/showthread.php?tid=650343)



Getting data from an array - AstroPoid - 25.02.2018

How can i know what is the data filled inside the first array , for example:
Код:
enum GANGSTUFFS
{
     stuffs,
     stuffs2
};
new gangstuff[MAX_GANGS][GANGSTUFFS];
i don't need anything from gangstuff , but i want to know how much gangs have a certain gang stuff selected and how can i detect if the gang have no amount of this stuff ? Please i need a quick reply as soon as possible


Re: Getting data from an array - Dayrion - 25.02.2018

https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays


Re: Getting data from an array - AstroPoid - 25.02.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Doesn't seem helpful on multi arrays at all. i used to get data easily from 1 array , and even 2 but i don't know how to get data from the first array instead of the second one.


Re: Getting data from an array - Dayrion - 26.02.2018

Quote:
Originally Posted by AstroPoid
Посмотреть сообщение
Doesn't seem helpful on multi arrays at all. i used to get data easily from 1 array , and even 2 but i don't know how to get data from the first array instead of the second one.
It is helpful. It's exactly the same thing for one, two, three or four array dimensions.
PHP код:
new Array1D[2],
    
Array2D[1][3],
    
Array3D[6][7][8];
Array1D[0] = 1000;
Array2D[0][2] = 54;
Array3D[4][5][2] = 97451
When it comes enum, you have to replace the index by the variable's name.
PHP код:
enum E_TEST
{
    
value_random,
    
something_else
};
new 
Array3D[30][99][E_TEST];
Array3D[20][50][value_random] = 99