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

Checking if a bool is true for all Terrorists


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 07-07-2010 , 22:49   Checking if a bool is true for all Terrorists
Reply With Quote #1

How would I check if all T's have:

PHP Code:
gIsFrozen[id] = true 
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.

Last edited by GXLZPGX; 07-08-2010 at 02:59.
GXLZPGX is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-07-2010 , 23:36   Re: How to check if bool is true for all T's?
Reply With Quote #2

Use a loop

Or

Use bit flags for your bools instead of an array. You can then compare the value of this var with a var holding bit flags for all players on terrorist team.
__________________

Last edited by Bugsy; 07-07-2010 at 23:38.
Bugsy is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 07-08-2010 , 02:59   Re: How to check if bool is true for all T's?
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Use a loop

Or

Use bit flags for your bools instead of an array. You can then compare the value of this var with a var holding bit flags for all players on terrorist team.
Same thing wrecked told me. Example?
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-08-2010 , 07:37   Re: How to check if bool is true for all T's?
Reply With Quote #4

Quote:
Originally Posted by GXLZPGX View Post
Same thing wrecked told me. Example?
PHP Code:
new Terrorists;

TerroristJoinTeamid )
     
Terrorists |= ( << id );

TerroristLeaveTeamid )
     
Terrorists &= ~( << id );

if( ( 
Terrorists VariableThatHoldsFrozenPlayers ) == Terrorists )
{
     
//All terrorists are frozen

SnoW is offline
Send a message via MSN to SnoW
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2010 , 10:06   Re: How to check if bool is true for all T's?
Reply With Quote #5

You will have an issue when id=32.

PHP Code:
new Terrorists;

TerroristJoinTeamid )
     
Terrorists |= ( << ( id 31 ) );

TerroristLeaveTeamid )
     
Terrorists &= ~( << ( id 31 ) ); 
__________________
Bugsy is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 07-08-2010 , 10:42   Re: Checking if a bool is true for all Terrorists
Reply With Quote #6

why not ?
PHP Code:
if(cs_get_user_team(id) == CS_TEAM_T && gIsFrozen[id] = true ) { 
 
//User is terrorist and has gIsFrozen[id] = true 

__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2010 , 11:54   Re: Checking if a bool is true for all Terrorists
Reply With Quote #7

You can do this many ways but the above method is more efficient.
__________________
Bugsy is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-08-2010 , 13:56   Re: Checking if a bool is true for all Terrorists
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
You will have an issue when id=32.
You are right.

Quote:
Originally Posted by Brreaker View Post
why not ?
PHP Code:
if(cs_get_user_team(id) == CS_TEAM_T && gIsFrozen[id] = true ) { 
 
//User is terrorist and has gIsFrozen[id] = true 

You're using the wrong operator.
SnoW is offline
Send a message via MSN to SnoW
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 07-08-2010 , 14:31   Re: Checking if a bool is true for all Terrorists
Reply With Quote #9

Alright, the one Brreaker posted is the one I was thinking about. But wrecked said there was a better way. But since he isn't on, I guess I have to use this one for now.

Now for the mod I'm working on, I want it to end the round when the bool is true for all T's and select two random CT's for the beginning of next round, how would I do this?
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-08-2010 , 16:25   Re: Checking if a bool is true for all Terrorists
Reply With Quote #10

Quote:
Originally Posted by GXLZPGX View Post
Alright, the one Brreaker posted is the one I was thinking about. But wrecked said there was a better way. But since he isn't on, I guess I have to use this one for now.
Excuse me, but why do you totally ignore everything I and Bugsy have posted in this thread?
SnoW is offline
Send a message via MSN to SnoW
Reply



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 07:55.


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