General Question
Hi guys,
I always wondered: When I have something like this: PHP Code:
So: Is it bether to do: PHP Code:
PHP Code:
|
Re: General Question
you try to filtre "is user spectated or unassigned team"?
cs_get_user_team return team index if teamindex>0 then it will be true |
Re: General Question
I asked this before and IIRC, execution does not continue across an AND if the first condition is false. You could try to find my post and see what the answer was for sure.
You could even test it. Change "i" to an invalid player and run the code with g_mode = 0. If you get an error then it does execute, if no error then it doesn't execute. Quote:
|
Re: General Question
(Operation1 && Operation2) | True && False = Does Not pass
(Operation1 && Operation2) | False && True = Does Not Pass (Operation1 && Operation2) | False && False = Does Not Pass (Operation1 && Operation2) | True && True = Pass. (Operation1 || Operation2) | True || False = Pass (Operation1 || Operation2) | False || True = Pass (Operation1 || Operation2) | False || False = Does Not Pass (Operation1 || Operation2) | True || True = Pass. |
Re: General Question
Quote:
Fysiks is right, on a && check, if 1st check is false, other ones are not checked, on a || check, if 1st condition is true, other ones are not checked. That's why it's better to put fast checks (vars checks) before checks that imply natives calls or lot of compute. |
Re: General Question
Thank you fysiks and Connor :)
Btw: The Post fysiks was talking about: http://forums.alliedmods.net/showthread.php?t=85522 |
| All times are GMT -4. The time now is 00:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.