AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   operator question (https://forums.alliedmods.net/showthread.php?t=174646)

JoKeR LauGh 12-23-2011 07:39

operator question
 
is this true?
PHP Code:

if ( get_user_flags(id) && ADMIN_LEVEL_A 

is the same as

PHP Code:

if ( get_user_flags(id) & ADMIN_LEVEL_A 

Just need an answer , have tried the first method still no error but I curious with the second method .

Snaker beatter 12-23-2011 07:42

Re: operator question
 
NO:
&&: i known its just a shortcut of two 'if' native:

PHP Code:

// This:
if (native1 && native2)

// And this:
if (native1)
{
       if (
native2)
       {
       }
}

// Are same 

-------------------

Like: if (is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T:::

PHP Code:

if (is_user_alive(id)
{
       if (
cs_get_user_team(id) == CS_TEAM_T)
       {
       }



drekes 12-23-2011 08:15

Re: operator question
 
&& is the logical AND operator.
& is a bitwise operator.

Read more about the operators here:
http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf

fysiks 12-23-2011 11:47

Re: operator question
 
Quote:

Originally Posted by drekes (Post 1618277)
&& is the logical AND operator.
& is the bitwise AND operator.

Just a little fix :).


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

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