SA-MP Forums Archive
Setting bool array to false - 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 bool array to false (/showthread.php?tid=594806)



Setting bool array to false - SystemX - 23.11.2015

Will this work?
Код:
new bool:fo_moved[32]=false;
I want to set all the bools to false


Re: Setting bool array to false - AbyssMorgan - 23.11.2015

defaults are zero
PHP код:
new bool:fo_moved[32]; 



Re: Setting bool array to false - Vince - 23.11.2015

When initialized variables - given no explicit value - will have the value 0/false. So in this case it's not even necessary. If you still want to explicitly initialize an entire array you can use the progressive initializer, also known as the ellipsis operator: ... (literally three dots).

PHP код:
new bool:fo_moved[32] = {false, ...}; 
For more information see pawn-lang.pdf, section Data and declarations, subsection Progressive initiallers for arrays.