SA-MP Forums Archive
A Dialog Question? - 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: A Dialog Question? (/showthread.php?tid=270974)



A Dialog Question? - lawonama - 22.07.2011

I have this code:
pawn Код:
if(PlayerToPoint(1,playerid,270.0473,84.7454,1001.0391))
       {
       ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Password","Enter the security password, to open the cells:","OK","Cancel");
       }
If he writes example: 1234, then it will do blablabla
but if he writes something else then 1234 then it will do blublublu

Any help would be fine.


Re: A Dialog Question? - Calgon - 22.07.2011

Once a person enters text in to a dialog input box, the callback OnDialogResponse is called. You can use the dialog ID you specified (1) to track the response. Like so:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if(dialogid == 1) {
        // 'inputtext' contains the value of what the person entered in to your dialog.
        // since you want an integer (number), you need to strval the value
        new iNumber = strval(inputtext);
        // now we'll deal with checking if what the person entered is OK
        if(iNumber == 1234) {
            SendClientMessage(playerid, -1, "blablabla"); // the message you wanted
        } else return SendClientMessage(playerid, -1, "blublublu"); // the message returned if the person didn't enter 1234 into the message box
    }
   
    return 0;
}