Dialog Style List
#1

I'm working on a Administration Help dialog where Admins can click the rank, and show the commands for that level. However, I'd like the dialog to only list the selections from there rank.
I want the dialog to be a list like this:
http://oi41.tinypic.com/246jrlv.jpg

There's a total of 8 ranks, but let's say a level 5 types /ah and the dialog shows up, how would I make it to where only Level 1 through 5 are listed in the dialog_style_list

If this is a stupid question, and/or not even possible, I'm sorry. I'm just learning.
Reply
#2

How do you check if the player is an admin?
Reply
#3

if (PlayerInfo[playerid][pAdmin] >= #
Reply
#4

Something like this?

Dialog 1
Dialog 2

Code:

Command:

pawn Код:
CMD:ah(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, -1, "ERROR": "You aren't an admin level 1!");
    ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "Admin Help Center:", "{FFFFFF}Admin Level {FF0000}1 {FFFFFF}Commands\nAdmin Level {FF0000}2 {FFFFFF}Commands\nAdmin Level {FF0000}3 {FFFFFF}Commands\nAdmin Level {FF0000}4 {FFFFFF}Commands\nAdmin Level {FF0000}5 {FFFFFF}Commands\nAdmin Level {FF0000}6 {FFFFFF}Commands\nAdmin Level {FF0000}7 {FFFFFF}Commands\nAdmin Level {FF0000}8 {FFFFFF}Commands", "Select", "Close");
    return 1;
}
OnDialogResponse:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{    
    if(dialogid == 999)
    {
    if(response)
    {
    if(listitem == 0)
    {
    if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 1!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 1 Commands:", "Your commands for admin level 1. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 1)
    {
    if(PlayerInfo[playerid][pAdmin] < 2)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 2!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 2 Commands:", "Your commands for admin level 2. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 2)
    {
    if(PlayerInfo[playerid][pAdmin] < 3)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 3!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 3 Commands:", "Your commands for admin level 3. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 3)
    {
    if(PlayerInfo[playerid][pAdmin] < 4)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 4!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 4 Commands:", "Your commands for admin level 4. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 4)
    {
    if(PlayerInfo[playerid][pAdmin] < 5)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 5!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 5 Commands:", "Your commands for admin level 5. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 5)
    {
    if(PlayerInfo[playerid][pAdmin] < 6)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 6!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 6 Commands:", "Your commands for admin level 6. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 6)
    {
    if(PlayerInfo[playerid][pAdmin] < 7)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 7!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 7 Commands:", "Your commands for admin level 7. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    if(listitem == 7)
    {
    if(PlayerInfo[playerid][pAdmin] < 8)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 8!");
    else
    ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Admin Level 8 Commands:", "Your commands for admin level 8. Ex: \n/warn\n/kick\n/slap\n/etc...", "Ok", "");
    }
    }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Areax
Посмотреть сообщение
Something like this?

Dialog 1
Dialog 2
Exactly, and if it's a level 5 admin or something, the selections for Level 6 and higher won't appear in the list to even select. Is that possible?
Reply
#6

Quote:
Originally Posted by DJ_Shocker
Посмотреть сообщение
Exactly, and if it's a level 5 admin or something, the selections for Level 6 and higher won't appear in the list to even select. Is that possible?
I have added
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 4)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 4!");
So if the player is an admin level 1 and if he trying to click for level 4, it will say "You aren't an admin level 4!".

EDIT: so they can't see commands for higher level.
Reply
#7

Quote:
Originally Posted by Areax
Посмотреть сообщение
I have added
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 4)return SendClientMessage(playerid, -1, "[ERROR]: You aren't an admin level 4!");
So if the player is an admin level 1 and if he trying to click for level 4, it will say "You aren't an admin level 4!".

EDIT: so they can't see commands for higher level.
I see. Thanks.
I appreciate it.
Reply
#8

From reading what you want this is how I would have written your menu (at it's most basic level, of course you would need to edit it to make it better looking).

The command
pawn Код:
CMD:ah (playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS\nLevel 3 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS\nLevel 3 Admin CMDS\nLevel 4 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS\nLevel 3 Admin CMDS\nLevel 4 Admin CMDS\nLevel 5 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS\nLevel 3 Admin CMDS\nLevel 4 Admin CMDS\nLevel 5 Admin CMDS\nLevel 6 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS\nLevel 3 Admin CMDS\nLevel 4 Admin CMDS\nLevel 5 Admin CMDS\nLevel 6 Admin CMDS\nLevel 7 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Admin Help", "Level 1 Admin CMDS\nLevel 2 Admin CMDS\nLevel 3 Admin CMDS\nLevel 4 Admin CMDS\nLevel 5 Admin CMDS\nLevel 6 Admin CMDS\nLevel 7 Admin CMDS\nLevel 8 Admin CMDS", "Accept", "Cancel");
    }
    if (PlayerInfo[playerid][pAdmin] = 0)
    {
        return 0;
    }
    return 1;
}
Dialog Response
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
        switch(dialogid)
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0: //Admin level 1 CMDS
                    {
                        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "Level 1 CMD help", "/kick\n/warn\n/mute", "Okay", "Cancel");
                    }
                    case 1: //Admin level 2 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 2 CMD help", "bla bla bla level 2 commands", "Okay", "Cancel");
                    }
                    case 2: //Admin level 3 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 3 CMD help", "bla bla bla level 3 commands", "Okay", "Cancel");
                    }
                    case 3: //Admin level 4 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 4 CMD help", "bla bla bla level 4 commands", "Okay", "Cancel");
                    }
                    case 4: //Admin level 5 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 5 CMD help", "bla bla bla level 5 commands", "Okay", "Cancel");
                    }
                    case 5: //Admin level 6 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 6 CMD help", "bla bla bla level 6 commands", "Okay", "Cancel");
                    }
                    case 6: //Admin level 7 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 7 CMD help", "bla bla bla level 7 commands", "Okay", "Cancel");
                    }
                    case 7: //Admin level 8 CMDS
                    {
                        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Level 8 CMD help", "bla bla bla level 8 commands", "Okay", "Cancel");
                    }
                }
               
            }
        }
    }
}
I apologize for any errors I didn't have time to compile it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)