Dialog_Style_Password question
#1

I have a question, is it possible to move object with Dialog_Style_Password? if yes, how can I do it?
Reply
#2

Are you sure you're asking for the correct type of dialog? This seems bazar to me.


This is DIALOG_STYLE_PASSWORD.

If you're wanting DIALOG_STYLE_PASSWORD, do you want the object to move when it shows or when someone has imputted a word for example?

- Firewire
Reply
#3

I want it to move when somebody inputs right password for it like : 1234, I can change it to Dialog_Style_Input also, if it's impossible to do it with password.

This is progress I've made so far, but it doesn't seem to work:

pawn Код:
//on the top
    gate = CreateObject(980,-503.2999900,2592.6999500,54.8000000,0.0000000,0.0000000,269.0000000); //object(airportgate) (1)
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Chat", "Type your chat input here.", "Submit", "Cancel");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 3)
    {
        if(!response) // If they clicked 'Cancel' or pressed esc
        {
            SendClientMessage(playerid, COLOR_RED, "You MUST type correct pass to open gate.");
            //For info & code of this function please refer to the bottom of this article.
        }
        else // Pressed ENTER or clicked 'Login' button
        {
            if(!strcmp(inputtext, "1234", true))
            {
                DestroyObject(gate);
            }
            else
            {
               SendClientMessage(playerid, COLOR_RED, "FAIL PASS.");
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }

    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
I made destroyobject for now, since it's easyer
Reply
#4

Just by looking at your dialogresponse it looks fine. But you need to change this:
PHP код:
if(!strcmp(inputtext"1234"true)) 
to

PHP код:
if(strcmp(inputtext"1234"true) == 0
- Firewire
Reply
#5

Nope, sadly it won't work
Reply
#6

I have just tested the code out for myself, put in a SendClientMessage or a PrintF to tell you if it's working.

PHP код:
if(strcmp(inputtext"1234"true) == 0)  
{
    
SendClientMessage(playerid, -1"Worked."); // Telling you it has worked
    
DestroyObject(gate);

This is what you should have now.

- Firewire
Reply
#7

I can't seem to get it to work, can you copy me your code, to make sure im not doing something wrong :/

P.S. Sorry for being annyoing but if you use for the code it looks better
Reply
#8

I prefer it being in PHP BB codes as I find it easier to read and correct. It's just a personal preference.

In 'CODE' as requested:
pawn Код:
gate = CreateObject(980,-503.2999900,2592.6999500,54.8000000,0.0000000,0.0000000,269.0000000); //object(airportgate) (1)


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Chat", "Type your chat input here.", "Submit", "Cancel");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 3)
    {
        if(!response) // If they clicked 'Cancel' or pressed esc
        {
            SendClientMessage(playerid, COLOR_RED, "You MUST type correct pass to open gate.");
            //For info & code of this function please refer to the bottom of this article.
        }
        else // Pressed ENTER or clicked 'Login' button
        {
            if(strcmp(inputtext, "1234", true) == 0)
            {
                DestroyObject(gate);
                SendClientMessage(playerid, -1, "Worked");
            }
            else
            {
               SendClientMessage(playerid, COLOR_RED, "FAIL PASS.");
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
    return 0;
}
I use ZCMD as my command processor so i've used your old script for '/mycommand'. If the command isn't working, please tell me and i'll write a new one for you.

- Firewire
Reply
#9

NEVERMIND! Sorry! Im and idiot, it's because in another FS I have had selected the dialog ID already, thats why it didn't work, thanks alot again!

REP +
Reply
#10

You can't rep, you need 50+ post count.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)