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

Bool Value Bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lolzin123
Member
Join Date: Apr 2009
Old 08-10-2009 , 12:43   Bool Value Bug
Reply With Quote #1

I use this case to changing the bool , but when it's turn on... never turn off again.
PHP Code:
case 5// BOOL
        
{
            if (
g_bool[id] == true
            { 
                
g_bool[id] = false ;
            } 
            if (
g_bool[id] == false
            { 
                
g_bool[id] = true ;
            } 
        } 
lolzin123 is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-10-2009 , 12:44   Re: Bool Value Bug
Reply With Quote #2

in second if use "else if"

also you can use

g_bool[id] = !g_bool[id];
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
lolzin123
Member
Join Date: Apr 2009
Old 08-10-2009 , 13:09   Re: Bool Value Bug
Reply With Quote #3

but this gonna make the effect of turn ON and OFF ?

"g_bool[id] = !g_bool[id];"
lolzin123 is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-10-2009 , 13:11   Re: Bool Value Bug
Reply With Quote #4

Yes
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
lolzin123
Member
Join Date: Apr 2009
Old 08-10-2009 , 13:15   Re: Bool Value Bug
Reply With Quote #5

TNX man
lolzin123 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-10-2009 , 13:31   Re: Bool Value Bug
Reply With Quote #6

Quote:
Originally Posted by lolzin123 View Post
but this gonna make the effect of turn ON and OFF ?

"g_bool[id] = !g_bool[id];"
This method is a toggle. It will always change it to true if it's false or to false if it's true, which is what you were trying to do with your if statement.
__________________
fysiks is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 08-10-2009 , 18:22   Re: Bool Value Bug
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
This method is a toggle. It will always change it to true if it's false or to false if it's true, which is what you were trying to do with your if statement.
crash ?!
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-10-2009 , 19:23   Re: Bool Value Bug
Reply With Quote #8

How would that crash?

Code:
new bool:g_bTestBool = true; public MyFunction( ) {     g_bTestBool = !g_bTestBool;         // setting it to the value OPPOSITE of what it currently is     // true = !false ( !false reads as "not false", and true is not false )     // false = !true ( !true reads as "not true", and false is not true )         // if g_bTestBool = true     // g_bTestBool = !true = false         // if g_bTestBool = false     // g_bTestBool = !false = true         // it is the same as this code     if( g_bTestBool ) // check if true     {         g_bTestBool = false;     }     else // g_bTestBool is false     {         g_bTestBool = true;     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-10-2009 , 20:55   Re: Bool Value Bug
Reply With Quote #9

Quote:
Originally Posted by One View Post
crash ?!
I tested it before I posted.
__________________
fysiks is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 08-11-2009 , 02:26   Re: Bool Value Bug
Reply With Quote #10

& i tested after i posted. i did it in task & got crashed maybe i did anything wrong but i got crashed in loop
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 18:06.


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