OR (||) and (&&) problem -
kalanerik99 - 15.11.2015
Hello
I have been testing something and found out something wierd
If I use this:
PHP код:
if(PlayerInfo[playerid][AdminLevel] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
I Have to be just LEVEL 5 "
OR" RCON ADMIN
If I use this:
PHP код:
if(PlayerInfo[playerid][AdminLevel] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
I Have to be just LEVEL 5 "
AND" RCON ADMIN
Isnt that wierd

?
And on the wiki:
&&------------- and ------------- if (Left && Right)
||-------------- or ------------- if (Left || Right)
Re: OR (||) and (&&) problem -
IceBilizard - 15.11.2015
so what you want to do?
Re: OR (||) and (&&) problem -
kalanerik99 - 15.11.2015
I am testing it
They are switched..
Is it a bug.....?
Re: OR (||) and (&&) problem -
SecretBoss - 15.11.2015
It's not weird you can't understand what your code means, you typed if 5 is more than player's level the player is not addmin this is why both printed the same thing
Re: OR (||) and (&&) problem -
IstuntmanI - 15.11.2015
This is correct:
pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
The error appears if you aren't admin level 5
AND you aren't RCON admin. So if you have admin level 5 but you aren't RCON you won't receive that error.
Re: OR (||) and (&&) problem -
kalanerik99 - 15.11.2015
Read everything
I sad that in the start
But it works switched
In that case U sad you have to be LEVEL 5
OR RCON ADMIN
Thats wierd.-....
Re: OR (||) and (&&) problem -
thefirestate - 15.11.2015
Quote:
Originally Posted by kalanerik99
Hello
I have been testing something and found out something wierd
If I use this:
PHP код:
if(PlayerInfo[playerid][AdminLevel] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
I Have to be just LEVEL 5 " OR" RCON ADMIN
If I use this:
PHP код:
if(PlayerInfo[playerid][AdminLevel] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
I Have to be just LEVEL 5 " AND" RCON ADMIN
Isnt that wierd  ?
And on the wiki:
&&------------- and ------------- if (Left && Right)
||-------------- or ------------- if (Left || Right)
|
I wouldn't say it is a bug in any way, let me tell you what it means with words.
PHP код:
if(PlayerInfo[playerid][AdminLevel] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
If your level is below five and isplayeradmin gave me zero I am telling you that you are not an admin.
PHP код:
if(PlayerInfo[playerid][AdminLevel] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You arent admin");
If your level is below five or isplayeradmin gave me zero I am telling you that you are not an admin.
It makes perfect sense, at least for me.
Re: OR (||) and (&&) problem -
kalanerik99 - 15.11.2015
Yeaaaaa but it works switched!!!!!!

Read everything and looak at my code completely
Re: OR (||) and (&&) problem -
thefirestate - 15.11.2015
Are you even listening? Or works the same way like before, the reason it is switched is because you are checking for the negative side of it, not the positive. if it was like:
if(PlayerInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
{
//Do your code
}
else return SendClientMessage(playerid, -1, "You are not an admin my friend.");
It would still work the same way.
Re: OR (||) and (&&) problem -
kalanerik99 - 15.11.2015
Hmmm ok
I will come back....
Bye for now