Dialogs and Passwords?
#1

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. :/
Reply
#2

Little mistake

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

Quote:
Originally Posted by MadeMan
Little mistake

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

but how to use tht for moveobjects?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)