A Dialog Question?
#1

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

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)