SA-MP Forums Archive
OnDialogResponse mistake. - 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)
+--- Thread: OnDialogResponse mistake. (/showthread.php?tid=661467)



OnDialogResponse mistake. - Fabyx15 - 05.12.2018

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", "");
			}
		}



Re: OnDialogResponse mistake. - Alexis17 - 05.12.2018

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""");
                }
            }
        } 



Re: OnDialogResponse mistake. - Fabyx15 - 05.12.2018

I did the enum, still the same


Re: OnDialogResponse mistake. - Kaliber - 05.12.2018

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


Re: OnDialogResponse mistake. - Fabyx15 - 05.12.2018

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];



Re: OnDialogResponse mistake. - Kaliber - 05.12.2018

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

Maybe load crashdetect and look if errors occur.


Re: OnDialogResponse mistake. - Fabyx15 - 05.12.2018

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


Re: OnDialogResponse mistake. - Kaliber - 05.12.2018

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.


Re: OnDialogResponse mistake. - Fabyx15 - 05.12.2018

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