admin level problem -
JXF - 02.06.2016
Код:
if (!( 5 <= level <= 1337 ) return SCM(pid, -1, "You cannot do this!");
I want to make it so one can not set the admin level between 6-1336
but this line makes it so i can set the admin smaller or equal to 1337 but not less or equal to 5
what can I do?
same result with:
Код:
if ( 6 >= level <= 1336 ) return SCM(pid, -1, "You cannot do this!");
Re: admin level problem -
F1N4L - 02.06.2016
Код:
if (level < 6 || level > 1336) return SCM(pid, -1, "You cannot do this!");
Re: admin level problem -
oMa37 - 02.06.2016
PHP код:
if(level < 6 || level > 1336) return SCM(pid, -1, "You cannot do this!");
Re: admin level problem -
Deroxi - 02.06.2016
Pawn is different from normal mathematics in terms
Re: admin level problem -
F1N4L - 02.06.2016
Quote:
Originally Posted by Deroxi
Pawno is different from normal mathematics in terms
|
Pawn*
Re: admin level problem -
JXF - 02.06.2016
I don t know if this is an issue for me, but I know that
means or, and
means and, but these operators work the opposite for me - && as or and || as and
Re: admin level problem -
Sjn - 02.06.2016
Quote:
Originally Posted by JXF
I don t know if this is an issue for me, but I know that means or, and means and, but these operators work the opposite for me - && as or and || as and
|
I don't think something like that is possible lol.
Anyway, this is a piece of text taken from Slice's
Tips & Tricks thread which maybe useful for you in this case.
Quote:
A few examples:
Код:
a && b(); // if a, run b.
a && b() || c(); // if a, run b. otherwise, run c.
a || b(); // if not a, run b.
a && b() || c && d(); // if a, run b. otherwise, if c, run d.
a && b() && c(); // if a, run b. if b isn't false, run c.
|
Re: admin level problem -
Dayrion - 02.06.2016
Quote:
Originally Posted by JXF
I don t know if this is an issue for me, but I know that means or, and means and, but these operators work the opposite for me - && as or and || as and
|
if(a == 0 || b ==1) - If a = 0 OR b = 1 so..
if(a == 0 && b == 1) - If a = 0 AND b = 1 so..
Код:
if ( 6 >= level <= 1336 ) return SCM(pid, -1, "You cannot do this!");
This is not possible in mathematic.
Check what oMa37 / F1N4L wrote. This is right.
Quote:
Originally Posted by Deroxi
Pawn is different from normal mathematics in terms
|
Why ? Because you can not do this?
if(level(6
∪ 1336)) return SCM(pid, -1, "You cannot do this!");
Re: admin level problem -
PrO.GameR - 02.06.2016
if ( 5 < level < 1337 )
Why do you people make it hard? ^^ that actually works in pawn (it doesn't in C++)
Quote:
Originally Posted by JXF
I don t know if this is an issue for me, but I know that means or, and means and, but these operators work the opposite for me - && as or and || as and
|
It's because of ! before your statement, simply means NOT these.
Re: admin level problem -
JXF - 02.06.2016
Quote:
Originally Posted by oMa37
PHP код:
if(level < 6 || level > 1336) return SCM(pid, -1, "You cannot do this!");
|
that does not work. for me, the correct way I figured out would be:
Код:
if(level >= 6 && level <= 1336) return SCM(pid, -1, "You cannot do this!");
you wouldn't be able to set admins between 6-1336 with this line.
here is what I meant about the operators:
Album
this statement says that if you are not an admin level 4 OR not a RCON admins to return an admin_message, meaning that a player with RCON acces should be able to use this command, while he isn't. strangely, the operator || works the opposite as the &&