SA-MP Forums Archive
Pressing an letter/key then execute something ?????? - 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: Pressing an letter/key then execute something ?????? (/showthread.php?tid=571774)



Pressing an letter/key then execute something ?????? - PURG3D - 22.04.2015

Is it possible that if i press LETTER / KEY / NUMBERS . Then it will execute something i want ?

For example i pressed "y" then it will tp me to something i want.


Re: Pressing an letter/key then execute something ?????? - Threshold - 22.04.2015

Yes.


Re: Pressing an letter/key then execute something ?????? - jessejanssen - 22.04.2015

Yes it is possible, but only with certain keys, you can find the available keys here: https://sampwiki.blast.hk/wiki/Keys

Best regards,
Jesse


Re: Pressing an letter/key then execute something ?????? - PURG3D - 22.04.2015

So whats the code guys ?


Re: Pressing an letter/key then execute something ?????? - JaydenJason - 22.04.2015

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: Pressing an letter/key then execute something ?????? - Azula - 22.04.2015

PHP код:
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
PRESSED(KEY_YES))
    {
        
// do something
    
}
    return 
1;




Re: Pressing an letter/key then execute something ?????? - PURG3D - 22.04.2015

Thank you alot Azula and Jayden

Also at jessejanssen for the list of keys

+REP TO ALL OF YOU