Dialog Response
#1

Code:
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ADMIN_HELP)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Moderator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 1:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 2)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Game Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 2:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Lead Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 3:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 4)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Manager", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
            }

        }
    }
    return 1;
}
I want the cancel button to redirect me back to /Ah pls halp
Reply
#2

if(!response)
return ShowPlayerDialog(...)

(on phone)

EDIT:

pawn Code:
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ADMIN_HELP)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Moderator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 1:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 2)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Game Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 2:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Lead Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 3:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 4)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Manager", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
            }

        }
        else    
            return ShowPlayerDialog(/*Insert the whole syntax, keep the same define "DIALOG_ADMIN_HELP"*/);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by TheToretto
View Post
if(!response)
return ShowPlayerDialog(...)

(on phone)

EDIT:

pawn Code:
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ADMIN_HELP)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Moderator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 1:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 2)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Game Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 2:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Lead Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 3:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 4)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Manager", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
            }

        }
        else    
            return ShowPlayerDialog(/*Insert the whole syntax, keep the same define "DIALOG_ADMIN_HELP"*/);
    }
    return 1;
}
didnt redirect me back

Code:
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ADMIN_HELP)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Moderator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 1:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 2)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Game Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 2:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Lead Administrator", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
                case 3:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 4)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Manager", "/help\n/Milk\n/Baked\n/bread", "Cancel", "");
                    }
                    else
                        return SendClientMessage(playerid, COLOR_RED, "You are not authorized to access this section!");
                }
            }

        }
        else    
            return ShowPlayerDialog(playerid, DIALOG_ADMIN_HELP, DIALOG_STYLE_LIST, "Commands","Server Moderator\nGame Administrator\nLead Administrator\nServer Manager","Select","Close");
    }
    return 1;
}
doesnt work probs because the scm does give it a response, no?
Reply
#4

Shouldn't you return 0 for OnDialogResponse ?
Reply
#5

pawn Code:
if(!response) return ShowPlayerDialog(playerid, DIALOG_ADMIN_HELP, DIALOG_STYLE_LIST, "Commands","Server Moderator\nGame Administrator\nLead Administrator\nServer Manager","Select","Close");
Add it above:

pawn Code:
if(response)
Reply
#6

Quote:
Originally Posted by KinderClans
View Post
pawn Code:
if(!response) return ShowPlayerDialog(playerid, DIALOG_ADMIN_HELP, DIALOG_STYLE_LIST, "Commands","Server Moderator\nGame Administrator\nLead Administrator\nServer Manager","Select","Close");
Add it above:

pawn Code:
if(response)
Not specially, it's a boolean, the order doesn't matter, if he click ESC it'll set response to false and won't run the true case.
Reply
#7

Quote:
Originally Posted by TheToretto
View Post
Not specially, it's a boolean, the order doesn't matter, if he click ESC it'll set response to false and won't run the true case.
This is my current one:

Code:
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_ADMIN_HELP)
    {
        if(response)
        {
            new flag = true;
            switch(listitem)
            {
                case 0:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Moderator", "{0085d6}Server Moderator Help:\n{eaeaea}The following commands are for Server Moderators:\n\n/aduty - Goes on admin duty\n/adminmoney - Give yourself money", "Cancel", "");
                    }
                    else
                        flag = false;
                }
                case 1:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 2)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Game Administrator", "{0085d6}Game Administrator Help:\n{eaeaea}The following commands are for Game Administrators:\n\n/aduty - Goes on admin duty", "Cancel", "");
                    }
                    else
                        flag = false;
                }
                case 2:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Lead Administrator", "{0085d6}Lead Administrator Help:\n{eaeaea}The following commands are for Lead Administrators:\n\n/aduty - Goes on admin duty", "Cancel", "");
                    }
                    else
                        flag = false;
                }
                case 3:
                {
                    if(PlayerInfo[playerid][pAdmin] >= 4)
                    {
                        ShowPlayerDialog(playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_MSGBOX, "Server Manager", "{0085d6}Server Manager Help:\n{eaeaea}The following commands are for Server Managers:\n\n/aduty - Goes on admin duty\n/makeadmin - Makes a player an admin [LEVEL 1-4]", "Cancel", "");
                    }
                    else
                        flag = false;
                }
            }
 
            if(!flag){
                SendClientMessage(playerid, COLOR_RED, "ERROR: Not high enough rank to access this section!");
                ShowPlayerDialog(playerid, DIALOG_ADMIN_HELP, DIALOG_STYLE_LIST,"Commands","Server Moderator\nGame Administrator\nLead Administrator\nServer Manager","Select","Close");
            }
 
        }        
    }
    return 0;
}
It only returns me back when I don't have access to that case
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)