If statements help
#1

Okay so I have:

pawn Код:
CMD:ahelp(playerid, params[]) {
 if(PlayerInfo[playerid][Admin] >= 1)
 {
  SendClientMessage(playerid,COLOR_WHITE,"Level 1: /kick /freeze /unfreeze");
  return 1;
 }
 if(PlayerInfo[playerid][Admin] >= 5)
 {
  SendClientMessage(playerid,COLOR_WHITE,"Level 5: /setadmin /gmx");
  return 1;
 }
 else return SendClientMessage(playerid,COLOR_RED,"You aren't an admin.");
}
Now, I am a level 5 admin, and when I go into the server and do /ahelp, it will only show the Level 1 commands, and not the level 5 commands.

How can I make it so that if you are level 5, you can see all the level 5 commands and lower, and if your level 2, you can see all the level 2 commands and lower, etc
Reply
#2

You only need to put the returns at another position
pawn Код:
CMD:ahelp(playerid, params[]) {
 if(PlayerInfo[playerid][Admin] == 0)
  return SendClientMessage(playerid,COLOR_RED,"You aren't an admin.");
 if(PlayerInfo[playerid][Admin] >= 1)
 {
  SendClientMessage(playerid,COLOR_WHITE,"Level 1: /kick /freeze /unfreeze");
 }
 if(PlayerInfo[playerid][Admin] >= 5)
 {
  SendClientMessage(playerid,COLOR_WHITE,"Level 5: /setadmin /gmx");
 }
 return 1;
}
Reply
#3

Quote:
Originally Posted by ♣ Joker ♠
You only need to put the returns at another position
pawn Код:
CMD:ahelp(playerid, params[]) {
 if(PlayerInfo[playerid][Admin] == 0)
  return SendClientMessage(playerid,COLOR_RED,"You aren't an admin.");
 if(PlayerInfo[playerid][Admin] >= 1)
 {
  SendClientMessage(playerid,COLOR_WHITE,"Level 1: /kick /freeze /unfreeze");
 }
 if(PlayerInfo[playerid][Admin] >= 5)
 {
  SendClientMessage(playerid,COLOR_WHITE,"Level 5: /setadmin /gmx");
 }
 return 1;
}
Thanks, it works
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)