SA-MP Forums Archive
Dialog mixed with KeyChange... - 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)
+--- Thread: Dialog mixed with KeyChange... (/showthread.php?tid=449827)



Dialog mixed with KeyChange... - Lajko1 - 10.07.2013

Hello, what I want to do is, if player is near object and pressed ENTER there dialog will show to the player.
But when I pressed enter it fastly opens the dialog, and when I released enter it close the dialog, how can I do it when I will press enter dialog won't disappear ?

+How can I put this thing in quote thingy it's something like [pawno] [/pawno] ? or what ever it is :P

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInRangeOfPoint(playerid,0.7,1581.500000 0,-1708.8000488,3619.1999512) && (PRESSED(KEY_SECONDARY_ATTACK)))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Which jail cell door do you want to open?", "Jail cell door 1\nJail cell door 2\nJail cell door 3", "Open", "Cancel");
}
return 1;
}

Thank you for help in advance =)


Re: Dialog mixed with KeyChange... - Misiur - 10.07.2013

The problem lies within OnDialogResponse. When you release enter it receives response 0, and closes the dialog. Solution? Show the dialog on enter release:
pawn Код:
PRESSED => RELEASED
It's [pawn].

#e:
Or in OnDialogResponse show dialog again first time when response is 0.


Re: Dialog mixed with KeyChange... - Lajko1 - 10.07.2013

pawn Код:
Thank you =) now it works great ;)
.