OnDialogResponse mistake.
#1

So i have this on OnDialogResponse, the thing is that i've made a command to introduce jobs informations, so when i chose the listitem jobs, the dialog is closing and nothing is happening. here's the code

Top of the code with dialogs id's
Код:
#define DIALOG_CMD_HELP		3
#define DIALOG_CMD_HELP2 	4
#define DIALOG_CMD_HELP3	5
#define DIALOG_CMD_HELP4 	6
The /help command with the listitem 'Jobs'
Код:
CMD:help(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_CMD_HELP, DIALOG_STYLE_LIST, "Help sistem", "Jobs", "Next", "Cancel");
	return 1;
}
Then the ondialogresponse code
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case DIALOG_CMD_HELP:
		{
			if(response || listitem == 0)
			{
				if(PlayerStatus[playerid][pJob] == 0) ShowPlayerDialog(playerid, DIALOG_CMD_HELP2, DIALOG_STYLE_MSGBOX, "", "{DEDEDE}Momentan nu detii nici un job.\nFoloseste {FFE2A3}/jobs {DEDEDE}pentru a merge sa te angajezi.", "Ok","");	
				else if(PlayerJob[playerid][pFisher] == 1) ShowPlayerDialog(playerid, DIALOG_CMD_HELP3, DIALOG_STYLE_MSGBOX, "", "{FFE2A3}Comenzi disponibile:\n{FFE2A3}/fish {DEDEDE}» Folosita pentru a pescui in zona corespunzatoare\n{FFE2A3}/sellfish {DEDEDE}» Folosita pentru a vine pestele intr-un businesss tip '24/7', \n{FFE2A3}/quitjob {DEDEDE}» Folosita pentru a renunta la jobul actual", "Ok", "");
				else if(PlayerJob[playerid][pTrucker] == 1) ShowPlayerDialog(playerid, DIALOG_CMD_HELP4, DIALOG_STYLE_MSGBOX, "", "{FFE2A3}/jobs {DEDEDE}» Foloseste aceasta comanda pentru a selecta jobul 'Trucker' si pentru a ajunge cu ajutorul unu checkpoint la actorul langa care trebuie sa apesi tasta 'Enter'\n{FFE2A3}/quitjob {DEDEDE}» Folosita pentru a renunta la jobul actual", "Ok", "");
			}
		}
Reply
#2

Quote:
Originally Posted by Fabyx15
Посмотреть сообщение
Код:
#define DIALOG_CMD_HELP		3
#define DIALOG_CMD_HELP2 	4
#define DIALOG_CMD_HELP3	5
#define DIALOG_CMD_HELP4 	6
I recommend using enumerations for dialogues.

PHP код:
enum
{
    
DIALOG_CMD_HELP,
    
DIALOG_CMD_HELP2,
    
DIALOG_CMD_HELP3,
    
DIALOG_CMD_HELP4
};
CMD:help(playeridparams[])
{
    
ShowPlayerDialog(playeridDIALOG_CMD_HELPDIALOG_STYLE_LIST"Help sistem""Jobs""Next""Cancel");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_CMD_HELP:
        {
            if(!
response) return 1;
            switch(
listitem)
            {
                case 
0:
                {
                    if(!
PlayerStatus[playerid][pJob]) return ShowPlayerDialog(playeridDIALOG_CMD_HELP2DIALOG_STYLE_MSGBOX"""{DEDEDE}Momentan nu detii nici un job.\nFoloseste {FFE2A3}/jobs {DEDEDE}pentru a merge sa te angajezi.""Ok","");
                    else if(
PlayerJob[playerid][pFisher]) return ShowPlayerDialog(playeridDIALOG_CMD_HELP3DIALOG_STYLE_MSGBOX"""{FFE2A3}Comenzi disponibile:\n{FFE2A3}/fish {DEDEDE}» Folosita pentru a pescui in zona corespunzatoare\n{FFE2A3}/sellfish {DEDEDE}» Folosita pentru a vine pestele intr-un businesss tip '24/7', \n{FFE2A3}/quitjob {DEDEDE}» Folosita pentru a renunta la jobul actual""Ok""");
                    else if(
PlayerJob[playerid][pTrucker]) return ShowPlayerDialog(playeridDIALOG_CMD_HELP4DIALOG_STYLE_MSGBOX"""{FFE2A3}/jobs {DEDEDE}» Foloseste aceasta comanda pentru a selecta jobul 'Trucker' si pentru a ajunge cu ajutorul unu checkpoint la actorul langa care trebuie sa apesi tasta 'Enter'\n{FFE2A3}/quitjob {DEDEDE}» Folosita pentru a renunta la jobul actual""Ok""");
                }
            }
        } 
Reply
#3

I did the enum, still the same
Reply
#4

Try it with:

PHP код:
case 0

    if(!
PlayerStatus[playerid][pJob]) return ShowPlayerDialog(playeridDIALOG_CMD_HELP2DIALOG_STYLE_MSGBOX"""{DEDEDE}Momentan nu detii nici un job.\nFoloseste {FFE2A3}/jobs {DEDEDE}pentru a merge sa te angajezi.""Ok",""); 
    else if(
PlayerJob[playerid][pFisher]) return ShowPlayerDialog(playeridDIALOG_CMD_HELP3DIALOG_STYLE_MSGBOX"""{FFE2A3}Comenzi disponibile:\n{FFE2A3}/fish {DEDEDE}» Folosita pentru a pescui in zona corespunzatoare\n{FFE2A3}/sellfish {DEDEDE}» Folosita pentru a vine pestele intr-un businesss tip '24/7', \n{FFE2A3}/quitjob {DEDEDE}» Folosita pentru a renunta la jobul actual""Ok"""); 
    else if(
PlayerJob[playerid][pTrucker]) return ShowPlayerDialog(playeridDIALOG_CMD_HELP4DIALOG_STYLE_MSGBOX"""{FFE2A3}/jobs {DEDEDE}» Foloseste aceasta comanda pentru a selecta jobul 'Trucker' si pentru a ajunge cu ajutorul unu checkpoint la actorul langa care trebuie sa apesi tasta 'Enter'\n{FFE2A3}/quitjob {DEDEDE}» Folosita pentru a renunta la jobul actual""Ok"""); 
    else 
SendClientMessage(playerid, -1"Seems like you have a job, that needs no help.");

Maybe..you have a wrong job
Reply
#5

The variables are setted correct on top of the gm.

Код:
enum pStatus
{
	pJob, pDrivingL, pGunL, pBoatL, pHeliL, pFaction
}
enum pAllJobs
{
	pTrucker, pFisher
}
new  PlayerStatus[MAX_PLAYERS][pStatus],
	PlayerJob[MAX_PLAYERS][pAllJobs];
Reply
#6

Yeah, but what happens, if you use the Dialog now?

Maybe load crashdetect and look if errors occur.
Reply
#7

If i use the dialog now, when i click the button 'Next' on the dialog with the listitem it is closing all the dialogs and nothing happens instead of showing another dialogs. Crashdetect it is not showing anything
Reply
#8

So even with my message?

So you have to check if this is actually called.

Use a print somewhere in the OnDialogResponse and watch, if you can see it.

If no print is called, maybe the Callback is hooked wrong somewhere.
Reply
#9

I put instead of return ShowPlayerDialog, sendclientmessage and it is working. So it have somehting with the dialog....it is not showing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)