If statements help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: If statements help (
/showthread.php?tid=145113)
If statements help -
Memoryz - 01.05.2010
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
Re: If statements help -
Nero_3D - 01.05.2010
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;
}
Re: If statements help -
Memoryz - 01.05.2010
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