SA-MP Forums Archive
how would..? - 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 would..? (/showthread.php?tid=659672)



how would..? - Alteh - 12.10.2018

Pressing a key for a few seconds (while pressing) shows the function.

is for OnPlayerKeyStateChange.

Do any idea how is possible?


Re: how would..? - KinderClans - 12.10.2018

This?

pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))
pawn Код:
if(HOLDING(YOUR_KEY))
{
      //Yourcode
}



Re: how would..? - khRamin78 - 12.10.2018

Quote:
Originally Posted by Alteh
Посмотреть сообщение
Pressing a key for a few seconds (while pressing) shows the function.

is for OnPlayerKeyStateChange.

Do any idea how is possible?
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Read
Holding key part


Re: how would..? - KinderClans - 12.10.2018

I know already what is holding key. OP said "Pressing a key for few seconds", so it's holding?

@OP: Check @khRamin's link to get an idea.


Re: how would..? - Alteh - 12.10.2018

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
This?

pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))
pawn Код:
if(HOLDING(YOUR_KEY))
{
      //Yourcode
}
Quote:
Originally Posted by ******
Посмотреть сообщение
Start a timer in OnPlayerKeyStateChange when they start pressing the key. Kill the timer in the same place if they ever release it. Then do what you want in the timer function.

very thanks! i was able to do it!