Raised This Month: $ Target: $400
 0% 

Simple Question


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-06-2010 , 22:45   Re: Simple Question
Reply With Quote #2

Quote:
Originally Posted by GXLZPGX View Post
Was looking at this:
http://forums.alliedmods.net/showpos...53&postcount=2

Why did he use:

if (!(get_user_flags(id)&ADMIN_KICK))

Instead of:

if (!get_user_flags(id)&ADMIN_KICK)
Though you as a scripter may know what you're attempting to do, the compiler does not. This is why you must follow order of operations and use parenthesis where needed. Here, parenthesis are needed because we want to evaluate the NOT value of the entire condition. Without parenthesis, the compiler will first evaluate the result of !get_user_flags(id) and then do a bit comparison with ADMIN_KICK.
__________________

Last edited by Bugsy; 07-06-2010 at 22:58.
Bugsy is offline
 



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:15.


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