Quote:
Originally Posted by EpicMonkey
so what your saying is as simple as:
PHP Code:
if(attacker == g_test1 || attacker == g_test2 && victim != g_test1 || victim != g_test2)
{
return HAM_SUPERCEDE;
}
else if(attacker != g_test1 || attacker != g_test2 && victim == g_test1 || victim == g_test2
{
return HAM_SUPERCEDE;
}
|
Now you need to learn grouping conditionals.
PHP Code:
if(attacker == g_test1 || attacker == g_test2 && victim != g_test1 || victim != g_test2)
// means
if attacker is g_test1
or
if attacker is g_test2 and victim is not g_test1
or
if victim is not g_test2
Obviously, that's not what you want. So add parenthesis to show the OR should be like this:
PHP Code:
if((attacker == g_test1 || attacker == g_test2) && (victim != g_test1 || victim != g_test2))
// means
if attacker is g_test1 or g_test2
and
if victim is not g_test1 or if victim is not g_test2
That is still wrong because g_test1 and g_test2 are different values, so victim will never be both, therefore (victim != g_test1 || victim != g_test2) will always be true, like this:
PHP Code:
(1 != 1 || 1 != 2) = (false || true) = true
(2 != 1 || 2 != 2) = (true || false) = true
(3 != 1 || 3 != 2) = (true || true) = true
You should check AND instead of OR since you don't want the victim to be either of those players:
PHP Code:
(victim != g_test1 && victim != g_test2)
__________________