Raised This Month: $12 Target: $400
 3% 

Solved Arrays assiging same value to all elements


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ish12321
Veteran Member
Join Date: May 2016
Old 04-20-2018 , 14:42   Arrays assiging same value to all elements
Reply With Quote #1

Hey,
I've a boolean multidimensional array : new bool:array[33][33];
Now, I want to set all elements of array[id] to true. One way is using looping. Is there any other way to do it in single line, something like array[id] = {false, false, ...}; without having to type false 33 times ?
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here

Last edited by ish12321; 04-20-2018 at 22:49.
ish12321 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-20-2018 , 15:34   Re: Arrays assiging same value to all elements
Reply With Quote #2

You can do that = { x , x, ...} number when declaring only.

You can use arrayset() at runtime.
__________________
Bugsy is offline
ish12321
Veteran Member
Join Date: May 2016
Old 04-20-2018 , 22:49   Re: Arrays assiging same value to all elements
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
You can do that = { x , x, ...} number when declaring only.

You can use arrayset() at runtime.
Thanks for telling about arrayset()
__________________
['O|s|G'] | Death Wins a.k.a Ish Chhabra was here
ish12321 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode