AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   != is not, but how what if & ??? (https://forums.alliedmods.net/showthread.php?t=146811)

reinert 01-01-2011 13:37

!= is not, but how what if & ???
 
Hey, I wan't to check

if(get_user_flags(someone1) & ADMIN_LEVEL_H && get_user_flags(someone2) **IS NOT [ !& - not working ;D ] ** ADMIN_LEVEL_H)

!(get_user_flags(someone2) & ADMIN_LEVEL_H) ??

Arkshine 01-01-2011 13:56

Re: != is not, but how what if & ???
 
You answer yourself and that's something you could test alone.

reinert 01-01-2011 14:08

Re: != is not, but how what if & ???
 
yeah I found solution, but I didn't know is it good, so thanks for ur answer too :)

Exolent[jNr] 01-01-2011 14:46

Re: != is not, but how what if & ???
 
Not to confuse you, but another way is this:

Code:
if( ~get_user_flags(someone2) & ADMIN_LEVEL_H ) {     // someone2 does NOT have ADMIN_LEVEL_H }

reinert 01-01-2011 14:49

Re: != is not, but how what if & ???
 
Thanks.

marquezs 01-01-2011 21:01

Re: != is not, but how what if & ???
 
Quote:

Originally Posted by Exolent[jNr] (Post 1383831)
Not to confuse you, but another way is this:

Code:
if( ~get_user_flags(someone2) & ADMIN_LEVEL_H ) {     // someone2 does NOT have ADMIN_LEVEL_H }

is it the same as this

Code:
if(!(get_user_flags(someone2) & ADMIN_LEVEL_H)) {     // someone2 does NOT have ADMIN_LEVEL_H }

fysiks 01-01-2011 21:27

Re: != is not, but how what if & ???
 
Quote:

Originally Posted by marquezs (Post 1384091)
is it the same as this

Code:
if(!(get_user_flags(someone2) & ADMIN_LEVEL_H)) {     // someone2 does NOT have ADMIN_LEVEL_H }

The result is the same, yes, it's just done differently internally.

marquezs 01-01-2011 21:52

Re: != is not, but how what if & ???
 
Ok, thanks. And which one is more efficient? Or it doesn't matter since it's so little code

Exolent[jNr] 01-01-2011 21:55

Re: != is not, but how what if & ???
 
Only way to tell that is to profile it.
https://forums.alliedmods.net/showthread.php?t=67752

marquezs 01-01-2011 21:57

Re: != is not, but how what if & ???
 
Ok, I'll try it, thank you


All times are GMT -4. The time now is 02:08.

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