Raised This Month: $ Target: $400
 0% 

Question about grouping...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 04-07-2006 , 15:26   Question about grouping...
Reply With Quote #1

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?
organizedKaoS is offline
c0rdawg
Senior Member
Join Date: Jan 2006
Old 04-07-2006 , 18:19  
Reply With Quote #2

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
c0rdawg is offline
Send a message via AIM to c0rdawg Send a message via MSN to c0rdawg
capndurk
Senior Member
Join Date: Feb 2006
Old 04-07-2006 , 18:42  
Reply With Quote #3

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 ;)
capndurk is offline
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 04-07-2006 , 18:45  
Reply With Quote #4

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



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 16:39.


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