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

help with code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DIFF
Member
Join Date: Aug 2009
Old 04-01-2010 , 08:09   help with code
Reply With Quote #1

can someone say me what this part doing?
Code:
new bool:bEnabled = StringToInt(newValue) ? true : false
more big part of code...
Code:
public ConVarChanged_Color(Handle:convar,const String:oldValue[],const String:newValue[]) {
	if(!GetConVarBool(g_hCvar_Enable)) {
		return
	}

	new bool:bEnabled = StringToInt(newValue) ? true : false

	if(bEnabled != (StringToInt(oldValue) ? true : false)) {
		ColorBlocks(!bEnabled)
	}
}
as i understand... it creating new boolean named bEnabled, then making from string to Integer (newValue)... and then...
Tnx for help +)

Last edited by DIFF; 04-01-2010 at 08:09. Reason: simple
DIFF is offline
raydan
Senior Member
Join Date: Aug 2006
Old 04-01-2010 , 08:22   Re: help with code
Reply With Quote #2

Code:
new bool:bEnabled = StringToInt(newValue) ? true : false
same as
Code:
new bool:bEnabled = (StringToInt(newValue) != 0) ? true : false
also same as
Code:
new bool:bEnabled;
if(StringToInt(newValue) != 0)
 bEnabled = true;
else
bEnabled = false;
raydan is offline
DIFF
Member
Join Date: Aug 2009
Old 04-01-2010 , 15:43   Re: help with code
Reply With Quote #3

tnx... your explain helps me +)
DIFF is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 04-01-2010 , 15:55   Re: help with code
Reply With Quote #4

http://en.wikipedia.org/wiki/Ternary_operation
pheadxdll is offline
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 13:50.


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