SA-MP Forums Archive
Statement doesnt work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Statement doesnt work (/showthread.php?tid=489055)



Statement doesnt work - ZBits - 20.01.2014

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.


Re: Statement doesnt work - jakejohnsonusa - 20.01.2014

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+


Re: Statement doesnt work - Hansrutger - 20.01.2014

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



Re: Statement doesnt work - ZBits - 20.01.2014

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


Re: Statement doesnt work - FallweN - 20.01.2014

Put like this:

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



Re: Statement doesnt work - ZBits - 20.01.2014

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


Re: Statement doesnt work - ZBits - 20.01.2014

Fixed, FallweN's code works


Re: Statement doesnt work - FallweN - 20.01.2014

Thank you very much for REP