View Single Post
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-12-2009 , 15:38   Re: efficiency, if for escaping function question
Reply With Quote #5

Code:
if(get_user_team(killer) != get_user_team(victim))
 return HAM_IGNORED
if(!is_user_bot(killer))
 return HAM_IGNORED
if(victim == killer)
 return HAM_IGNORED
I would use this order:
Check if the killer is the victim.
Check if the killer is not a bot.
Check if the killer and the victim are on different teams.

Code:
if(victim == killer || !is_user_bot(killer) || get_user_team(killer) != get_user_team(victim))
    return HAM_IGNORED;
Reasoning:
1st check doesn't use any natives, only variable checks.
2nd check only uses 1 native.
3rd check uses 2 natives.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline