AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can I select all bool in 1 command? (https://forums.alliedmods.net/showthread.php?t=272596)

KuvZz 10-03-2015 11:13

Can I select all bool in 1 command?
 
Hello guys. Is it possible select all booleans?
For example
PHP Code:

new boolb_1[33]
new 
boolb_2[33]
new 
boolb_3[33]
//Anywhere...
b_(all_of_them)[id] = true 


Bugsy 10-03-2015 11:26

Re: Can I select all bool in 1 command?
 
Quote:

Originally Posted by KuvZz (Post 2349332)
Hello guys. Is it possible select all booleans?
For example
PHP Code:

new boolb_1[33]
new 
boolb_2[33]
new 
boolb_3[33]
//Anywhere...
b_(all_of_them)[id] = true 


To set 3 arrays like you have above using a bit-field:
PHP Code:

new b_all];
        
arraysetb_all , -sizeofb_all ) ); 


KuvZz 10-03-2015 11:36

Re: Can I select all bool in 1 command?
 
Okay, thanks :D

Bugsy 10-03-2015 11:45

Re: Can I select all bool in 1 command?
 
Quote:

Originally Posted by KuvZz (Post 2349347)
Okay, thanks :D

You could do it similarly using arrays like you have, but it would be 3 native calls.
PHP Code:

new boolb_1[33]
new 
boolb_2[33]
new 
boolb_3[33]
    
arraysetb_1 true sizeofb_1 ) ); 
arraysetb_2 true sizeofb_2 ) ); 
arraysetb_3 true sizeofb_3 ) ); 


KuvZz 10-03-2015 11:50

Re: Can I select all bool in 1 command?
 
Ok, using 1 is better I guess. Thanks again.

Bugsy 10-03-2015 11:53

Re: Can I select all bool in 1 command?
 
Yes, but it requires a little knowledge of using bit fields. ie, how to set, check, clear values etc.

KuvZz 10-03-2015 11:55

Re: Can I select all bool in 1 command?
 
Quote:

Originally Posted by Bugsy (Post 2349357)
Yes, but it requires a little knowledge of using bit fields. ie, how to set, check, clear values etc.

I forgot all about pawn but I can try and remember xD
Thanks btw

Bugsy 10-03-2015 11:58

Re: Can I select all bool in 1 command?
 
Bit operations are not specific to Pawn. If you know it, you know it.


All times are GMT -4. The time now is 22:10.

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