SA-MP Forums Archive
Setting vallue of all cells to -1 - 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: Setting vallue of all cells to -1 (/showthread.php?tid=551485)



Setting vallue of all cells to -1 - Riwerry - 19.12.2014

Hi I have array for example:

new arr[NUMBER][ENUM];

I want to have it like:
arr[0] = -1;
arr[1] = -1;

etc just want to inicialize it at declaration of variable if it is possible..

I want to set all cells to -1, how I can do that without loop? Ty.


Re: Setting vallue of all cells to -1 - zaibaslr2 - 19.12.2014

You can't do it without a loop, the only thing you can do is
arr[0] = -1;
arr[1] = -1;
arr[2] = -1;
arr[3] = -1;
... and so on


Re: Setting vallue of all cells to -1 - Riwerry - 19.12.2014

I thought that it can work like new arr[NUMBER][ENUM] = {-1, ...} by some way like this but I can't remember.