View Single Post
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-20-2016 , 21:04   Re: Pro Become V.I.P. [re1.0.2]
Reply With Quote #11

Quote:
Originally Posted by didoWEE View Post
Functionality is not the same!

My way
PHP Code:
    if(!is_user_connected(killer))
        return 
HAM_IGNORED// if true - function stops --> 1 if
    
if(killer == victim)
        return 
HAM_IGNORED// if true - function stops --> 2 ifs
    
if(!is_real_player(killer))
        return 
HAM_IGNORED// if true - function stops --> 3 ifs
    
if(g_bFlagged[killer])
        return 
HAM_IGNORED// if true - function stops --> 4 ifs 
Your way
PHP Code:
if(!is_user_connected(killer) || killer == victim || !is_real_player(killer) || g_bFlagged[killer])
      return 
HAM_IGNORED// if true - function stops -> Always 4 ifs 
Actually it is same, just the 2nd way is more readable.

OR operator returns true on the first thing to return true.
Example:
PHP Code:
new 0;
if (
== || == || == 10// Will not check if x is 5 or 10 if x is 1. If x is 5, it will not check if x is 10.
    // Code here 
WildCard65 is offline