Statement doesnt work
#1

Hello,

I've been trying to make a command such as /setrank [playerid] [policeranklevel] available for both Admin level 3 and a Police Rank level 4. the problem is that unless you are both Admin level 3 and Police Rank 4 you are not able to set someone's rank.

What i want is, you dont have to be a level 3 admin to set someone rank, you have to be either both or one of them.

Here is what i tried.

pawn Код:
if(pInfo[playerid][pAdmin] < 3 || pInfo[playerid][pRank] < 4 ) return SendClientMessage(playerid,COLOR_ADMWHITE, "SERVER: Unknown command.");
Any help appreciated.
Reply
#2

Well, first make the code neater. I don't directly see any issues with the code, but this may solve the issue or confusion you have:

pawn Код:
if(pInfo[playerid][pAdmin] < 3 || pInfo[playerid][pRank] < 4 )//if the player is less than an Admin 3 AND/OR if the player is a rank of less than 4.
{
      SendClientMessage(playerid,COLOR_ADMWHITE, "SERVER: Unknown command.");//Wont work for them.
      return 1;
}
else//Everyone else can...
{
      //What you want Admin 3+ and/or Rank 4+ to be able to do with this command.
      return 1;
}

ALSO: Check to make SURE that when you're testing this, the Admin level IS 3+ and/or the Rank level IS 4+
Reply
#3

Why not just shorten pInfo[playerid][pAdmin] < 3 || pInfo[playerid][pRank] < 4 to
Код:
pInfo[playerid][pAdmin] <= 3
Reply
#4

Nope doesnt work, @hansrutger, i want to set that if a player is level 3 and not less that it,
Reply
#5

Put like this:

pawn Код:
if(pInfo[playerid][pAdmin] < 3 && pInfo[playerid][pRank] < 4 ) return SendClientMessage(playerid,COLOR_ADMWHITE, "SERVER: Unknown command.");
Reply
#6

wont that make the statment like you have to be a level 3 admin and a Police rank 4 to set the rank?
Reply
#7

Fixed, FallweN's code works
Reply
#8

Thank you very much for REP
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)