How to detect? - 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: How to detect? (
/showthread.php?tid=549761)
How to detect? -
Glossy42O - 08.12.2014
Hello, i don't need nothing, just simple link with a tut and i have tried to search
Anyways, how to detect if let's say.. i pressed Y and it shows me dialog?
Re: How to detect? -
HY - 08.12.2014
Code:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_YES))
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "test","You pressed Y!","Ok","Close");
}
return 1;
}
At the top of script:
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Search more Keys
right here!
Re: How to detect? -
Sawalha - 08.12.2014
it's simple. no tutorial needed be cause it's done in less lines:
pawn Код:
#define ANY_DIALOG 0
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_YES)
{
ShowPlayerDialog(..); // show dialog code
}
return 1;
}
P.S: this 'Y' button dosen't work on spectating mode.
EDIT: i'm late i guess :V
Re: How to detect? -
Glossy42O - 08.12.2014
Ah thanks)