SA-MP Forums Archive
ShowPlayerDialog with no response? - 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: ShowPlayerDialog with no response? (/showthread.php?tid=125144)



ShowPlayerDialog with no response? - MummyKillerSLO - 02.02.2010

Hello!

I wrote one filterscript for commands with dialogs. All was good, until I decide to make input dialog. When I clicked on any item on the list, the dialog just hide with no response.

Code:
#include <a_samp>

#define COLOR_RED 0xFF0000FF

#define DIALOG_CMDS_1 3
#define DIALOG_CMDS_2 4

public OnFilterScriptInit()
{
	print("Filterscript: COMMANDS");
	
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
	if (strcmp("/cmds",cmdtext,true) == 0)
	{
	  ShowPlayerDialog(playerid,DIALOG_CMDS_1,DIALOG_STYLE_LIST,"CrazyStunts Commands","\nRegister On Server\nLogin Into Server\nSend Private Message","Select","Cancel");
		return 1;
	}
	return 0;
}

public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
	if(dialogid == DIALOG_CMDS_1)
	{
	  if(response)
	  {
	    switch(listitem)
	    {
				case 0: ShowPlayerDialog(playerid,DIALOG_CMDS_2,DIALOG_STYLE_INPUT,"CrazyStunts Commands","Please write a password.","Register","Cancel");
			}
		}
	}
	return 1;
}
Did I write anything wrong? Please help.


Re: ShowPlayerDialog with no response? - MummyKillerSLO - 02.02.2010

Anyone please ?


Re: ShowPlayerDialog with no response? - hardstop - 02.02.2010

Well example i have this

And you did Dialogue wrong way. heres The right way:

Code:
	if (strcmp("/cmds",cmdtext,true) == 0)
	{
	  ShowPlayerDialog(playerid, 111, DIALOG_STYLE_LIST, "Server Commands", "Register on Server\Login On Server", "Select", "Cancle");
		return 1;
	}


Just change my OnDialogeResponse to what you need

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if (dialogid == 111)
	{
	if(response)
	{
	if(listitem == 0) //Register on server
	{
    //Do Something here
	}
	if(listitem == 1) //Login onserver
	{
    //Do Something here
	}
	}
	return 1;
	}

  return 0;
}



Re: ShowPlayerDialog with no response? - LuxurioN™ - 02.02.2010

Here a basic exemple for you:


Command:
pawn Code:
if (strcmp("/cmds",cmdtext,true) == 0)
{
ShowPlayerDialog(playerid,DIALOG_CMDS_1,DIALOG_STYLE_LIST,"CrazyStunts Commands","Register On Server\nLogin Into Server\nSend Private Message","Select","Cancel");
return 1;
}
In OnDialogResponse:

Response of dialog "DIALOG_CMDS_1"
pawn Code:
if(dialogid == DIALOG_CMDS_1)
{
if(response)
{
switch(listitem)
{
//Register On Server
case 0: ShowPlayerDialog(playerid,DIALOG_CMDS_2,DIALOG_STYLE_INPUT,"CrazyStunts Commands","Please write a password.","Register","Cancel");
//Login Into Server
case 1: ShowPlayerDialog(playerid,DIALOG_CMDS_2+1,DIALOG_STYLE_INPUT,"Login","Login","Login","Cancel");
//Send Private Message
case 2: ShowPlayerDialog(playerid,DIALOG_CMDS_2+2,DIALOG_STYLE_INPUT,"Client Message","Send a Client Message","Send!","Cancel");
}
}
return 1;
}
And, response of dialog "DIALOG_CMDS_2":
pawn Code:
if(dialogid == DIALOG_CMDS_2)
{
if(response == 0) //If has pressed 'Cancel'
{
SendClientMessage(playerid,COLOR_RED,"Register Canceled!");
}
if(response) //If has pressed 'Register'
{
//Function Here
SendClientMessage(playerid,COLOR_RED,"Register Successfully");
}
return 1;
}