Checking Dialog (+rep)
#1

Hello Scripterzzz.I need help with my check dialog problem.I want to make if player in dialog and when press F6 and type to say 'You have entered dialog you cant type now.' how can i make it ? If player have opened dialog ex. ShowPlayerDialog(... and when want player to talk anythink can not ? +rep
Reply
#2

You can't detect the "Fx(x)" keys using pawn.

The only keys you can detect are either with OnPlayerKeyStateChange or with GetPlayerKeys.

And the keys detectable are listed in the keys page of the wiki.
Reply
#3

bro i need when player is in dialog can not type how can i make it
Reply
#4

You can't.
Reply
#5

Yes, you can.
On the top:
pawn Код:
new dialog[MAX_PLAYERS];
Then create a new function:
pawn Код:
stock ShowPlayerDialogEx(playerid, dialogid, style, caption[], info[], button1[], button2[])
{
    ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
    dialog[playerid] = 1;
}
After this one:
pawn Код:
public OnDialogResponse(...)
{
    dialog[playerid] = 0;
    return 1;
}
And:
pawn Код:
//Under OnPlayerKeyStateChange check is player pressing T and if yes, check if(dialog[playerid] == 1) then Send client message "You can't type now"
Reply
#6

Well you can set a variable (array) to 1 for a player when a dialog is shown and to 0 when the dialog is hidden (after responding to a dialog, that's the part you have to set to 0). You may need to set it to 0 if the dialogid is a negative number which will hide any dialog shown.

After that, in OnPlayerText or OnPlayerCommandText (or the callbacks of ZCMD if you use), you can check if any dialog is shown and return an error message.

Although when a dialog is shown, I've never managed to be able to type on the chat. The box won't open.
Reply
#7

@kamiliuxliuxliux : It won't work for the simple reason that the key for opening the chat isn't detectable through OnPlayerKeyStateChange.
Reply
#8

kamiliuxliuxliux thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)