Levels
#9

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
Now you're getting me confused between NEITHER and EITHER. What Biess wrote up there was pretty much clear. Look...



But still you maybe right there. He needs to correct us here.
Read what he says:
Quote:

but i want it to check both so if you are either operator or admin you can use it.
The if-statement is there to check if he cannot use it, and then stop the command. You're mixing the two up

Quick example:
pawn Код:
if(( PInfo[ playerid ][ Level ] < 1) || ( PInfo[ playerid ][ Operator ] < 1 ))
//if this check is true - the command should not continue.
Let's translate it (simple/easy): IF the playervar's level-enum is lower than 1 (not admin) OR the playervar's operator-enum is lower than 1 (not operator).

This means that if either one is true, this statement will go through:

admin = false
operator = false
statement = true

admin = false
operator = true
statement = true

admin = true
operator = false
statement = true

admin = true
operator = true
statement = true

If he however want not only operator-admins to do the command, but also single operators and single admins, he would have to deny the command for players who are NEITHER admin OR operator (NOR), that means that he has to check both of them at the same time, and BOTH has to return false, else the command should go through.

Thus leaving us with the code:
pawn Код:
if(( PInfo[ playerid ][ Level ] < 1) && ( PInfo[ playerid ][ Operator ] < 1 ))
Translated: IF the playervar's level-enum is lower than 1 (not admin) AND the playervar's operator-enum is lower than 1 (not operator either)
____________________________________

Do you understand now? I can't really explain it more thouroughly.

If || was NOR, instead of OR, then it would be correct to use ||
Reply


Messages In This Thread
Levels - by Biess - 21.12.2012, 12:49
Re: Levels - by LarzI - 21.12.2012, 13:08
Re: Levels - by Zex Tan - 21.12.2012, 13:24
Re: Levels - by Biess - 21.12.2012, 13:38
Re: Levels - by LarzI - 21.12.2012, 13:53
Re: Levels - by Mr.Anonymous - 21.12.2012, 13:59
Re: Levels - by LarzI - 21.12.2012, 14:21
Re: Levels - by Mr.Anonymous - 21.12.2012, 14:31
Re: Levels - by LarzI - 21.12.2012, 15:10
Re: Levels - by Mr.Anonymous - 21.12.2012, 15:23

Forum Jump:


Users browsing this thread: 1 Guest(s)