AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question about grouping... (https://forums.alliedmods.net/showthread.php?t=26696)

organizedKaoS 04-07-2006 15:26

Question about grouping...
 
Whats the difference between
Code:
if((!is_user_bot(Players[i])) && (!is_user_connecting(Players[i])) && (cs_get_user_team(Players[i]) != CS_TEAM_SPECTATOR))
And
Code:
if(!is_user_bot(Players[i]) && !is_user_connecting(Players[i]) && cs_get_user_team(Players[i]) != CS_TEAM_SPECTATOR)
I have tried both in my plugin and both compile with no errors. I basically want to check if a player is not all of these three and if all the conditions met, then continue to the next part of code. Is this right?

c0rdawg 04-07-2006 18:19

I'm pretty sure they're the same, it just makes it a little easier to see where 1 condition starts and where 1 ends

capndurk 04-07-2006 18:42

on a side note, don't use Players[i] for every one of those; instead, do this:

Code:
new var = Players[i]; if((!is_user_bot(var)) && (!is_user_connecting(var)) && (cs_get_user_team(var) != CS_TEAM_SPECTATOR));

if you use Players[i], the logic of the program goes like this:
Code:

retrieve    i
retrieve    Players
retrieve    Players[i]
calculate  is_user_bot(Players[i])
retrieve    i
retrieve    Players
retrieve    Players[i]
calculate  is_user_connecting(Players[i])
retrieve    i
retrieve    Players
retrieve    Players[i]
calculate  cs_get_user_team(Players[i])

as opposed to:
Code:

retrieve    i
retrieve    Players
retrieve    Players[i]
store      var
retrieve    var
calculate  is_user_bot(var)
retrieve    var
calculate  is_user_connecting(var)
retrieve    var
calculate  cs_get_user_team(var)

it's just for increasing the speed of your program ;)

organizedKaoS 04-07-2006 18:45

Thanks for the var info durk. Ill try to implement the var now and see if it does save on processess. Thanks again.


All times are GMT -4. The time now is 16:38.

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