Difference between > < => =<
#1

For admin commands.
pawn Код:
if(PlayerInfo[playerid][pAdmin] > 5)
What's the difference between > < => =< ?
Reply
#2

> - is bigger than
< - is lower then
=< - is lower or equal to
=> - is bigger or equal to
Example:
Код:
new a;
a = 5;
if(a > 5) // it will return 0
if(a => 5) // it will return 1
Reply
#3

Okay thanks.

I get errors with this, what's the problem?

pawn Код:
case 4:
         {
              if(PlayerInfo[playerid][pAdmin] => 1); // Line 111
              {
                    return SendClientMessage(playerid, -1, "You are not an admin!");
              }
              else
              {
                    SetPlayerTeam(playerid, TEAM_ADMINS);
                    GameTextForPlayer(playerid, "~r~Admins", 1000, 3);
              }
          }
Код:
LGW.pwn(111) : warning 211: possibly unintended assignment
LGW.pwn(111) : error 029: invalid expression, assumed zero
LGW.pwn(111) : warning 215: expression has no effect
LGW.pwn(111) : error 001: expected token: ";", but found ")"
LGW.pwn(111) : error 029: invalid expression, assumed zero
LGW.pwn(111) : fatal error 107: too many error messages on one line
Reply
#4

> bigger than
pawn Код:
mean in your code :
if(PlayerInfo[playerid][pAdmin] > 5) //mean his level must be more than 5
< - is lower then
<= - is lower or equal to
>= - is bigger or equal to
!= mean if not to
pawn Код:
if(PlayerInfo[playerid][pAdmin] != 5)  // mean any admin level from 0 to 99999999 can use the cmd exccept level 5 cant use it
Код:
+rep if helped please
Reply
#5

I'm sure it has to be like this
Код:
if(PlayerInfo[playerid][pAdmin] < 1) // Line 111
              {
                    return SendClientMessage(playerid, -1, "You are not an admin!");
              }
Reply
#6

change to
pawn Код:
case 4:
         {
              if(PlayerInfo[playerid][pAdmin] >= 1) // Line 111
              {
                    return SendClientMessage(playerid, -1, "You are not an admin!");
              }
              else
              {
                    SetPlayerTeam(playerid, TEAM_ADMINS);
                    GameTextForPlayer(playerid, "~r~Admins", 1000, 3);
              }
          }
the edit is
pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 1)
    {
changes :
Код:
at the end of ** if (PlayerInfo[playerid][pAdmin] >= 1) ** dont type ;
problem replace => to >=
Код:
Dont Forgot the +rep if working
Reply
#7

yes, make sure to change => to >=, besides ; at the end of the line, that is also causing the errors
Reply
#8

> is higher than..
And < is lower than..

So your command means:
If the player is higher than level 5.

+rep is appreciated!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)