SA-MP Forums Archive
Dialogs and Passwords? - 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: Dialogs and Passwords? (/showthread.php?tid=126852)



Dialogs and Passwords? - Quincy_Gatlin - 10.02.2010

Well. I have seen you can make it to where you can make a dialog box come up and you can type in a password to open gates and doors, ect. I just started scripting again and I am new to dialogs. I am asking how do I make it to where you must enter a specific password into the box for an action to take place. Here I made a sample code to show you what I am talking about.

Код:
	if(strcmp(cmd, "/testduty", true) == 0)
	{
	  if(IsACop(playerid))
	  {
	  	ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "LVSP", "Enter your locker combination below.", "Enter", "Cancel");
			return 1;
	  }
	}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(IsACop(playerid))
	{
		if(dialogid == 1)
	  {
	    if(response == 1)
	    {
		  	if(strlen(inputtext)==4205)
			{
			   GivePlayerWeapon(playerid, 22, 1017);
		  	}
		  	else
		  	{
		  	  SendClientMessage(playerid, COLOR_LIGHTBLUE, "You entered the wrong combination.");
		  	  return 1;
		  	}
	    }
			if(response == 0)
			{
			  SendClientMessage(playerid, COLOR_RED, "You pressed cancel.");
			  return 1;
			}
	}
    return 1;
  }
  return 0;
}
If I put in 4205 is still says I have entered the wrong combination.
Код:
if(strlen(inputtext)==4205)
is probably the wrong thing to do. I am not sure since I am new to dialogs. If someone could help me thanks. :/


Re: Dialogs and Passwords? - MadeMan - 10.02.2010

Little mistake

pawn Код:
if(strval(inputtext)==4205)
strlen > strval


Re: Dialogs and Passwords? - Quincy_Gatlin - 10.02.2010

Quote:
Originally Posted by MadeMan
Little mistake

pawn Код:
if(strval(inputtext)==4205)
strlen > strval
Thanks very much! It works perfect now


Re: Dialogs and Passwords? - Darien - 17.01.2011

but how to use tht for moveobjects?