AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Arrays assiging same value to all elements (https://forums.alliedmods.net/showthread.php?t=306964)

ish12321 04-20-2018 14:42

Arrays assiging same value to all elements
 
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 ?

Bugsy 04-20-2018 15:34

Re: Arrays assiging same value to all elements
 
You can do that = { x , x, ...} number when declaring only.

You can use arrayset() at runtime.

ish12321 04-20-2018 22:49

Re: Arrays assiging same value to all elements
 
Quote:

Originally Posted by Bugsy (Post 2588636)
You can do that = { x , x, ...} number when declaring only.

You can use arrayset() at runtime.

Thanks for telling about arrayset()


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

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